probative 0.1.0__py3-none-any.whl

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 (84) hide show
  1. probative/__init__.py +14 -0
  2. probative/agents/__init__.py +1 -0
  3. probative/cli.py +167 -0
  4. probative/config.py +76 -0
  5. probative/core/__init__.py +1 -0
  6. probative/core/candidates.py +165 -0
  7. probative/core/critic.py +113 -0
  8. probative/core/evidence.py +158 -0
  9. probative/critics/__init__.py +26 -0
  10. probative/critics/base.py +66 -0
  11. probative/critics/constraint_critic.py +434 -0
  12. probative/critics/dependency_critic.py +132 -0
  13. probative/critics/evidence_auditor.py +127 -0
  14. probative/critics/invest.py +62 -0
  15. probative/critics/llm_judge.py +530 -0
  16. probative/critics/red_team.py +127 -0
  17. probative/critics/rubric.py +46 -0
  18. probative/critics/rubrics/constraint_critic/rubric.yaml +42 -0
  19. probative/critics/rubrics/dependency_critic/rubric.yaml +31 -0
  20. probative/critics/rubrics/evidence_auditor/rubric.yaml +74 -0
  21. probative/critics/rubrics/invest/rubric.yaml +67 -0
  22. probative/critics/rubrics/red_team/rubric.yaml +119 -0
  23. probative/critics/rubrics/segment_skeptic/rubric.yaml +47 -0
  24. probative/critics/rubrics/space_warden/rubric.yaml +24 -0
  25. probative/critics/runner.py +34 -0
  26. probative/critics/scoring.py +50 -0
  27. probative/critics/segment_skeptic.py +125 -0
  28. probative/critics/space_warden.py +57 -0
  29. probative/critics/testing.py +46 -0
  30. probative/critique/__init__.py +65 -0
  31. probative/critique/pipeline.py +374 -0
  32. probative/critique/report.py +230 -0
  33. probative/critique/roster.py +103 -0
  34. probative/critique/scoring.py +94 -0
  35. probative/critique/sources.py +198 -0
  36. probative/critique/verify.py +141 -0
  37. probative/exporters/__init__.py +1 -0
  38. probative/extract/__init__.py +33 -0
  39. probative/extract/chunking.py +47 -0
  40. probative/extract/pipeline.py +182 -0
  41. probative/extract/prompts.py +183 -0
  42. probative/extract/resolve.py +85 -0
  43. probative/extract/scoring.py +156 -0
  44. probative/formulas/__init__.py +1 -0
  45. probative/graph_runtime/__init__.py +1 -0
  46. probative/ingest/__init__.py +144 -0
  47. probative/ingest/_extracted.py +18 -0
  48. probative/ingest/_html.py +27 -0
  49. probative/ingest/_lines.py +41 -0
  50. probative/ingest/_tracker_text.py +71 -0
  51. probative/ingest/_wiki.py +30 -0
  52. probative/ingest/ado_csv.py +74 -0
  53. probative/ingest/confluence.py +91 -0
  54. probative/ingest/confluence_word.py +128 -0
  55. probative/ingest/csv_.py +50 -0
  56. probative/ingest/docx_.py +66 -0
  57. probative/ingest/jira_csv.py +76 -0
  58. probative/ingest/jira_html.py +116 -0
  59. probative/ingest/jira_xml.py +94 -0
  60. probative/ingest/markdown.py +70 -0
  61. probative/ingest/pdf.py +76 -0
  62. probative/ingest/text.py +20 -0
  63. probative/ingest/tracker.py +158 -0
  64. probative/ingest/xlsx.py +61 -0
  65. probative/interfaces/__init__.py +1 -0
  66. probative/interfaces/doctor.py +189 -0
  67. probative/interfaces/mcp_server.py +487 -0
  68. probative/llm/__init__.py +21 -0
  69. probative/llm/factory.py +85 -0
  70. probative/llm/fake.py +47 -0
  71. probative/llm/litellm_provider.py +86 -0
  72. probative/llm/provider.py +34 -0
  73. probative/llm/structured.py +38 -0
  74. probative/llm/types.py +51 -0
  75. probative/render/__init__.py +1 -0
  76. probative/render/_view.py +125 -0
  77. probative/render/design.py +63 -0
  78. probative/render/html.py +256 -0
  79. probative/render/markdown.py +122 -0
  80. probative-0.1.0.dist-info/METADATA +143 -0
  81. probative-0.1.0.dist-info/RECORD +84 -0
  82. probative-0.1.0.dist-info/WHEEL +4 -0
  83. probative-0.1.0.dist-info/entry_points.txt +2 -0
  84. probative-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,46 @@
1
+ """Load and validate a rubric YAML file (S2)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import yaml
8
+ from pydantic import ValidationError
9
+
10
+ from probative.core.critic import MalformedRubricError, Rubric, RubricNotFoundError
11
+
12
+
13
+ def load_rubric(path: Path) -> Rubric:
14
+ """Parse and validate one rubric YAML file.
15
+
16
+ Raises `RubricNotFoundError` if `path` does not exist, `MalformedRubricError`
17
+ if the file is not valid YAML, is not a mapping at the top level, or fails
18
+ `Rubric`'s schema.
19
+ """
20
+ if not path.is_file():
21
+ raise RubricNotFoundError(path, "rubric file not found")
22
+ try:
23
+ raw = yaml.safe_load(path.read_text())
24
+ except yaml.YAMLError as exc:
25
+ raise MalformedRubricError(path, f"invalid YAML: {exc}") from exc
26
+ if not isinstance(raw, dict):
27
+ raise MalformedRubricError(path, "rubric document must be a YAML mapping")
28
+ try:
29
+ return Rubric.model_validate(raw)
30
+ except ValidationError as exc:
31
+ raise MalformedRubricError(path, f"schema violation: {exc}") from exc
32
+
33
+
34
+ def resolve_fixture_paths(rubric: Rubric, rubric_path: Path) -> tuple[list[Path], list[Path]]:
35
+ """Resolve `rubric.clean_fixtures`/`defect_fixtures` — globs relative to
36
+ `rubric_path`'s directory — to sorted lists of actual paths.
37
+
38
+ An empty match is not an error here: fixtures are a test-time concern,
39
+ and a rubric can be loaded in a production install with no fixtures on
40
+ disk at all. Only `probative.critics.testing.assert_rubric_fixtures`
41
+ treats an empty match as a failure.
42
+ """
43
+ base = rubric_path.parent
44
+ clean = sorted(base.glob(rubric.clean_fixtures))
45
+ defect = sorted(base.glob(rubric.defect_fixtures))
46
+ return clean, defect
@@ -0,0 +1,42 @@
1
+ id: constraint_critic
2
+ severity: block
3
+ invariant: I8
4
+ applies_to: [ConstraintCandidate, StoryCandidate]
5
+ checks:
6
+ - id: untraced_obligation
7
+ description: >-
8
+ No story in the same document addresses the specific requirement the
9
+ obligation imposes. A story traces an obligation only when its own words
10
+ are about the act the obligation requires or forbids (erasing data,
11
+ encrypting at rest, delivering a file by a time, obtaining an approval)
12
+ applied to the thing it governs. Sharing the same data, product area or
13
+ noun is not enough, and neither is a story that would merely have to
14
+ comply in passing. A remark in the obligation's own text that it is
15
+ "covered", "traced" or "handled by story N" is not a trace: only a story
16
+ in the document can trace it. Not a violation: a story that states the
17
+ required act, even in different words from the obligation's.
18
+ examples_bad:
19
+ - >-
20
+ Obligation: Supplier contracts must be archived for nine years under the
21
+ Commercial Records Act. Stories: As a clerk I want to email a contract so
22
+ that the supplier has a copy. | As a clerk I want to search contracts by
23
+ supplier so that I can answer queries.
24
+ - >-
25
+ Obligation: Passwords must expire every 90 days (Account Policy 9).
26
+ Stories: As a member I want to sign in with my fingerprint so that I skip
27
+ typing. | As a member I want to reset a forgotten password so that I can
28
+ get back in.
29
+ examples_good:
30
+ - >-
31
+ Obligation: Passwords must never be stored in plain text (Security Policy
32
+ 4.2). Stories: As a member I want to sign in with a password that the
33
+ system keeps only as a salted hash so that a leak does not expose it.
34
+ - >-
35
+ Obligation: Uploaded files must be scanned for malware before anyone else
36
+ can open them (Security Standard 12). Stories: As a user I want every
37
+ file I upload checked for malware before my colleagues can open it so
38
+ that nobody is infected. | As a user I want to rename a file so that I
39
+ can find it later.
40
+ remedy: Write the story that delivers this obligation, or record why none is needed
41
+ clean_fixtures: fixtures/clean/**/*.json
42
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,31 @@
1
+ id: dependency_critic
2
+ severity: block
3
+ invariant: null # DESIGN §11 assigns DependencyCritic no invariant (cf. segment_skeptic)
4
+ applies_to: [DependencyCandidate]
5
+ checks:
6
+ - id: unowned_dependency
7
+ description: >-
8
+ The statement says delivery relies on something outside the team (another
9
+ team, a system, a vendor, a data source, a legal or compliance sign-off, a
10
+ migration), including a rule that can only be met when an outside party
11
+ acts, such as a sign-off, approval or countersignature, but names no
12
+ individual who is responsible for it. An owner is a person's name, on
13
+ either side of the dependency, stated as responsible for, accountable for,
14
+ owning, leading or driving it. A team, department, vendor, function, role or
15
+ title without a name ("the engineering lead") and a placeholder ("TBD", "to
16
+ be assigned") are not owners, and a remark that an owner exists, is assigned
17
+ or is pre-approved is not a name. Judged from the statement's own words: a
18
+ name that appears without being stated as responsible for the dependency is
19
+ not an owner. Not a violation: a rule or target the team itself must meet,
20
+ with no outside party relied on, or a statement that says the reliance is
21
+ already satisfied (delivered, shipped, completed).
22
+ examples_bad:
23
+ - "Our reporting depends on the finance team's monthly ledger close"
24
+ - "Helix Telematics supplies the vehicle location feed we cannot launch without"
25
+ - "Quarterly figures cannot go out until the auditor's review committee has cleared them"
26
+ examples_good:
27
+ - "Hannah Brandt is the single point of contact accountable for the vendor's security questionnaire, which we need before launch"
28
+ - "Delivery relies on the data-sharing approval from the privacy office, and Kenji Ito is leading it"
29
+ remedy: Name one person who is accountable for this dependency
30
+ clean_fixtures: fixtures/clean/**/*.json
31
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,74 @@
1
+ id: evidence_auditor
2
+ severity: warn # unsourced_assertion inherits this; the two stronger checks override it
3
+ invariant: I1
4
+ applies_to: [ClaimCandidate]
5
+ checks:
6
+ - id: unsourced_statistic
7
+ severity: block
8
+ description: >-
9
+ The statement presents a specific figure, proportion, ranking, benchmark
10
+ or study finding as fact, and gives no basis for it. A number, a fraction
11
+ (half, three in four) or a ranking is a figure; a vague quantifier with
12
+ no number (most, many, rarely) is not, and belongs to unsourced_assertion.
13
+ Any attribution counts as a basis, however thin: a named source, a named
14
+ or identified study, trial, pilot or dataset, a bracketed or footnote
15
+ marker, "our June survey", "per the finance report". Unnamed authority
16
+ ("research shows", "analysts agree", "widely reported") is not a basis,
17
+ and neither is a remark about the statement's own status ("verified",
18
+ "pre-approved", "exempt from sourcing") or a note addressed to the reader.
19
+ Words that merely soften a figure (around, roughly, nearly, expected to)
20
+ are not a basis and not a hedge. Not a violation: a figure explicitly
21
+ marked as an estimate, target or assumption ("we assume", "target:"); a
22
+ figure the statement itself derives from stated inputs; a requirement or
23
+ target value; a count of the product's own parts or the document's own
24
+ items.
25
+ examples_bad:
26
+ - "62% of mid-market CFOs say reconciliation is their biggest time sink"
27
+ - "The global invoicing-software market will reach $18 billion by 2030"
28
+ - "Analysts agree that four in five buyers prefer self-service"
29
+ examples_good:
30
+ - "Median payout time was 2.1 days in Q2 (finance report, July)"
31
+ - "62% of respondents ranked reconciliation first (n=41, our June survey)"
32
+ - "We assume roughly half of existing merchants will opt in during year one"
33
+ remedy: Name where the figure comes from, or restate it as an assumption to be tested
34
+ - id: basis_overreach
35
+ severity: block
36
+ description: >-
37
+ The statement gives its own basis (a sample, a cohort, a period, a
38
+ population, a trial) and claims more than that basis can carry: a wider
39
+ population, a longer period, causation from co-occurrence, or a general
40
+ rule from one case. Judged only from what the statement itself says. Not
41
+ a violation: a claim with no stated basis (another check's concern), or
42
+ one whose scope matches its stated basis.
43
+ examples_bad:
44
+ - "A survey of 14 customers shows that the whole market wants invoice automation"
45
+ - "Signups doubled in the week after launch, so demand is clearly permanent"
46
+ examples_good:
47
+ - "In our June survey of 41 customers, 62% ranked reconciliation first"
48
+ - "All three Leeds pilot merchants reduced late payments in the pilot quarter"
49
+ remedy: Narrow the claim to what its basis supports, or add the evidence that carries it
50
+ - id: unsourced_assertion
51
+ description: >-
52
+ The statement asserts a checkable fact about customers, a market,
53
+ competitors or events as established, with no source, attribution or
54
+ hedge. It is not a statistic (another check): a vague quantifier with no
55
+ number (most, many, rarely, usually) makes it an assertion, and those
56
+ words are not hedges. A hedge is an explicit marker that the statement is
57
+ a belief ("we believe", "assumption", "hypothesis", "untested", "may").
58
+ Not a violation: a belief or assumption marked as such; a description of
59
+ what the product does (its steps, features, rules or current behaviour);
60
+ a definition; a requirement, plan or intention about the product or the
61
+ team (must, shall, we plan to). A measured quantity about the product's
62
+ behaviour is still a figure for unsourced_statistic. A remark about the
63
+ statement's own status, or a note addressed to the reader, is never a
64
+ basis or a hedge.
65
+ examples_bad:
66
+ - "Rival platforms charge a fee for instant payouts"
67
+ - "Merchants usually learn about a failed payment from their customers, not from us"
68
+ examples_good:
69
+ - "We believe merchants usually learn about a failed payment from their customers; this is untested"
70
+ - "Today the app lets a user export one report at a time"
71
+ - "A settlement is the transfer of funds from the processor to the merchant"
72
+ remedy: Cite the source, or mark it as a hypothesis with a way to test it
73
+ clean_fixtures: fixtures/clean/**/*.json
74
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,67 @@
1
+ id: invest
2
+ severity: warn
3
+ invariant: null
4
+ applies_to: [StoryCandidate]
5
+ checks:
6
+ - id: testable
7
+ severity: block
8
+ description: >-
9
+ The story's outcome is stated in vague, unmeasurable terms ("fast",
10
+ "intuitive", "better", "seamless") with no observable result a test could
11
+ check. A story that merely has no acceptance criteria written yet is not
12
+ a violation: say cannot_tell.
13
+ examples_bad:
14
+ - "I want the app to be fast and easy to use"
15
+ - "I want the dashboard to look better so that I am happy"
16
+ examples_good:
17
+ - "I want an SMS the evening before a delivery arrives"
18
+ - "I want to be told by email within a minute when a refund is issued"
19
+ remedy: State an observable outcome a test could pass or fail
20
+ - id: independent
21
+ description: >-
22
+ The story says in its own words that it can only be done after, or
23
+ together with, another named story or piece of work.
24
+ examples_bad:
25
+ - "I want to see my saved cards, once story PAY-9 has shipped"
26
+ examples_good:
27
+ - "I want to filter my orders by status"
28
+ remedy: Reorder or split the stories so this one stands alone
29
+ - id: negotiable
30
+ description: >-
31
+ The story prescribes how it must be built — a framework, datastore,
32
+ protocol or other implementation — instead of what the user needs.
33
+ examples_bad:
34
+ - "I want the list stored in PostgreSQL and rendered with Vue"
35
+ examples_good:
36
+ - "I want to find an order by its number"
37
+ remedy: Remove the implementation detail; state the user need
38
+ - id: valuable
39
+ description: >-
40
+ The story has no user or customer who benefits, or no benefit at all —
41
+ it is a task for the system or the team, not value to someone.
42
+ examples_bad:
43
+ - "As the system, I want to write rows to a log table"
44
+ - "As a developer, I want to move the helpers into a new folder"
45
+ examples_good:
46
+ - "As a merchant, I want to see unpaid invoices so that I can chase them"
47
+ remedy: Name who benefits and why, or fold the task into a story that has value
48
+ - id: estimable
49
+ description: >-
50
+ The story's own words leave its scope open-ended or explicitly undecided
51
+ ("whatever it takes", "details to be decided", "as many as possible").
52
+ examples_bad:
53
+ - "I want every system we might ever use to be connected, details later"
54
+ examples_good:
55
+ - "I want to import my contacts from a CSV file"
56
+ remedy: Pin down the scope, or split off the unknown as a research task
57
+ - id: small
58
+ description: >-
59
+ The story is epic-sized: it bundles several distinct capabilities (an
60
+ end-to-end workflow, a whole area of the product) into one story.
61
+ examples_bad:
62
+ - "I want a complete system for ordering, billing, shipping and returns"
63
+ examples_good:
64
+ - "I want to reorder a previous purchase in one click"
65
+ remedy: Split into stories that each fit in a single iteration
66
+ clean_fixtures: fixtures/clean/**/*.json
67
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,119 @@
1
+ id: red_team
2
+ severity: warn # a linter, not a gate: nothing here blocks (DESIGN §13)
3
+ invariant: null
4
+ applies_to: [ClaimCandidate, ForecastCandidate]
5
+ checks:
6
+ - id: rival_explanation
7
+ description: >-
8
+ The statement reports a change, trend, pattern or correlation, links it in
9
+ its own words to a cause or a conclusion (because, so, driving, shows that,
10
+ clearly, which is why, proves), and rules out no other explanation:
11
+ seasonality, a change in who or what was counted, a concurrent release or
12
+ event, a selection effect. Applies only to such a link; otherwise,
13
+ including for a bare report of a change with no stated cause or
14
+ conclusion, a definition, a description of what the product does, or a
15
+ prediction, it is met. Not a violation: a statement that names the
16
+ alternative it excludes or controls for ("in a randomised test", "after
17
+ removing the holiday week").
18
+ examples_bad:
19
+ - "Refund requests rose in March, which shows the redesigned receipt confuses buyers"
20
+ - "Members who open the weekly digest renew more often, so the digest keeps people subscribed"
21
+ examples_good:
22
+ - "Refund requests rose in March"
23
+ - "In a randomised test of 2,000 buyers, the redesigned receipt raised refund requests"
24
+ remedy: Name the other explanations and how each was excluded, or state the conclusion as a hypothesis
25
+ must_be_true: "For “{quote}” to support the conclusion drawn from it, the other plausible explanations must have been excluded."
26
+ - id: unstated_denominator
27
+ description: >-
28
+ The statement offers a raw count or amount as evidence that something is
29
+ large, common, growing or important, and gives neither the population or
30
+ total the count belongs to nor a comparison base. Applies only to a count
31
+ used that way; otherwise, including for a share or rate stated with its
32
+ population, a change stated with its starting and ending values, a count
33
+ of the product's own parts or of the document's own items, or a count that
34
+ only describes (how many people were interviewed), it is met.
35
+ examples_bad:
36
+ - "Support logged 1,900 chargeback disputes last quarter, a serious problem"
37
+ - "Over 300 sellers have asked for bulk upload"
38
+ examples_good:
39
+ - "Support logged 1,900 chargeback disputes last quarter, up from 1,100 the quarter before"
40
+ - "46 of the 210 sellers we surveyed asked for bulk upload"
41
+ remedy: Give the total the count is drawn from, or a before-and-after base
42
+ must_be_true: "“{quote}” is a large number only if the total it is drawn from is not larger still."
43
+ - id: definition_drift
44
+ description: >-
45
+ The statement compares a category or metric across time periods, groups or
46
+ sources without stating the category's boundary or how it is measured
47
+ (active users, churned accounts, failed payments, qualified leads,
48
+ conversions), so its meaning could differ between the things compared.
49
+ Applies only to such a comparison; otherwise, including for a statement
50
+ that defines the category, one that makes no comparison, one that only
51
+ proposes a comparison to be made later as a test, or one whose terms are
52
+ ordinary words with no measurement sense, it is met.
53
+ examples_bad:
54
+ - "Active accounts grew from 12,400 in January to 15,100 in June"
55
+ - "Qualified leads from the partner channel are double those from paid search"
56
+ examples_good:
57
+ - "Accounts that logged in at least once in the trailing 30 days grew from 12,400 in January to 15,100 in June"
58
+ - "The warehouse has two loading docks"
59
+ remedy: State how the category is defined and counted, and that it was counted the same way throughout
60
+ must_be_true: "The category in “{quote}” must have been defined and counted the same way in everything it is compared with."
61
+ - id: unstated_precondition
62
+ description: >-
63
+ The statement predicts an outcome that can only happen if someone other
64
+ than the team (customers, a partner, a competitor, a regulator) first
65
+ does a specific act that is not itself the outcome (adopts, agrees,
66
+ supplies, switches, signs), and treats that act as given without saying
67
+ so. Applies only to a prediction; otherwise, including for a statement
68
+ that names the condition (if, provided, assuming, once, "we assume"), one
69
+ that says it is to be tested, one whose outcome needs nothing from anyone
70
+ outside the team, one whose only outside act is the outcome itself, or any
71
+ statement that is not a prediction, it is met. A hedge or belief marker
72
+ alone (may, we believe, our bet) is not a statement that it is to be
73
+ tested.
74
+ examples_bad:
75
+ - "Guests will book the late checkout upgrade, lifting add-on revenue by a fifth"
76
+ - "Hospitals will route their referrals through the portal, cutting intake time in half"
77
+ examples_good:
78
+ - "If hospitals agree to route referrals through the portal, intake time should halve"
79
+ - "The nightly export will finish before 06:00"
80
+ remedy: State what others must do for the outcome to follow, as an assumption to be tested
81
+ must_be_true: "For “{quote}” to come about, the people outside the team whose actions it relies on must act as it assumes."
82
+ - id: no_adaptive_response
83
+ description: >-
84
+ The statement predicts an outcome from a change the team makes that
85
+ depends on others not working against it: it treats competitors,
86
+ suppliers, fraudsters or regulators as unchanging and does not
87
+ acknowledge that they may react (copy it, work around it, game it,
88
+ undercut it, retaliate). Applies only to a prediction of that kind;
89
+ otherwise, including for a statement that acknowledges the reaction, one
90
+ that predicts the reaction itself, one whose only outside actors simply
91
+ respond as intended (customers buying more), or any statement that is not
92
+ a prediction, it is met.
93
+ examples_bad:
94
+ - "Cutting the delivery fee will win away the local grocer's regular shoppers"
95
+ - "The new referral bonus will bring in a steady flow of genuine new members"
96
+ examples_good:
97
+ - "Cutting the delivery fee will win shoppers unless the local grocer matches it, which we expect"
98
+ - "Rival grocers are expected to match any fee cut within a month"
99
+ remedy: Say how the others are expected to respond and whether the outcome survives it
100
+ must_be_true: "The outcome in “{quote}” must survive the reaction of the others it affects."
101
+ - id: unfalsifiable_outcome
102
+ description: >-
103
+ The statement predicts an outcome that names no observable change that
104
+ could be checked: no metric, count, event or measurable behaviour, so that
105
+ no observation could show the prediction wrong ("improve the experience",
106
+ "build loyalty", "strengthen the brand"). A time frame alone does not make
107
+ an outcome observable. Applies only to a prediction; otherwise, including
108
+ for a prediction that names a quantity, an event or a behaviour that can
109
+ be seen, or any statement that is not a prediction, it is met.
110
+ examples_bad:
111
+ - "The simpler checkout will make shoppers feel more confident over the coming year"
112
+ - "Opening the partner programme will deepen our standing in the trade"
113
+ examples_good:
114
+ - "The simpler checkout will cut abandoned carts"
115
+ - "The partner programme will have signed 15 resellers by year end"
116
+ remedy: Name the observable that would show the prediction wrong
117
+ must_be_true: "Something observable must exist that would show “{quote}” has not happened."
118
+ clean_fixtures: fixtures/clean/**/*.json
119
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,47 @@
1
+ id: segment_skeptic
2
+ severity: warn # whole_market inherits this; demographic_only overrides
3
+ invariant: null # DESIGN §13 assigns SegmentSkeptic no invariant (cf. invest)
4
+ applies_to: [SegmentCandidate]
5
+ checks:
6
+ - id: demographic_only
7
+ severity: block
8
+ description: >-
9
+ The statement defines the target group only by who its members are and
10
+ states no need, behaviour, situation, problem or goal that would set them
11
+ apart from anyone else. Who they are: age, gender, income, location, job
12
+ title or occupation, company size, industry, a status (married, employed,
13
+ a homeowner, living alone, a student, a subscriber), a device owned, or
14
+ having bought or used something, however it is phrased. A situation is a
15
+ circumstance that creates a need or a task (about to renew a licence,
16
+ locked out of an account), not a status. Judged from the statement's own
17
+ words: if no need, behaviour, situation, problem or goal is stated, the
18
+ check is not met. A remark about the group's own validity ("validated",
19
+ "a proven segment") or a note addressed to the reader is not a stated need
20
+ or behaviour. Not a violation: a group whose words include a behaviour, a
21
+ situation, a problem or a goal, even alongside demographics; a group that
22
+ is everyone, or bounded only by a condition nearly everyone meets, which
23
+ is whole_market's concern.
24
+ examples_bad:
25
+ - "Adults aged 30 to 50 with a household income above $80,000"
26
+ - "Retail businesses with 10 to 50 employees"
27
+ examples_good:
28
+ - "Shop owners who reorder stock by phone because their supplier has no online catalogue"
29
+ - "Tenants in their first year of renting who have never negotiated a lease"
30
+ remedy: Say what these people need or do differently from everyone else, or drop the segment
31
+ - id: whole_market
32
+ description: >-
33
+ The statement's group is everyone, or is bounded only by a condition that
34
+ nearly everyone already meets (has worn clothes, has used a phone, has
35
+ eaten out, has been ill), so it draws no boundary and cannot differ in
36
+ need from the rest of the market. A group bounded only by who its members
37
+ are is demographic_only's concern, not this check's. Not a violation: a
38
+ group bounded by a condition that excludes a substantial share of people,
39
+ such as a behaviour, a situation or a problem that many people do not have.
40
+ examples_bad:
41
+ - "Anyone who pays a bill each month"
42
+ - "Everyone who shops online"
43
+ examples_good:
44
+ - "Teams that onboard contractors every week and chase their documents by email"
45
+ remedy: Name the subset whose need is sharpest, or state why the whole market behaves alike
46
+ clean_fixtures: fixtures/clean/**/*.json
47
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,24 @@
1
+ id: space_warden
2
+ severity: block
3
+ invariant: I3
4
+ applies_to: [NeedCandidate]
5
+ checks:
6
+ - id: solution_grammar
7
+ description: >-
8
+ The need names a feature, a screen or UI element, an implementation, or a
9
+ named technology instead of the customer benefit. Includes a benefit
10
+ statement that smuggles a solution in ("a mobile app so I can see my
11
+ balance"). Not a violation: words the customer uses for their own world
12
+ (a settlement, a bank statement, an order, a payout), or a need that is
13
+ merely vague or has no measurable target.
14
+ examples_bad:
15
+ - "users need a dashboard"
16
+ - "provide an API for reconciliation"
17
+ - "give shoppers a one-tap checkout button"
18
+ - "the system should use machine learning to recommend products"
19
+ examples_good:
20
+ - "help me see where my money went this month"
21
+ - "know whether a payment reached my account without calling anyone"
22
+ remedy: Restate as a customer benefit — verb first, customer voice
23
+ clean_fixtures: fixtures/clean/**/*.json
24
+ defect_fixtures: fixtures/seeded/**/*.json
@@ -0,0 +1,34 @@
1
+ """Fan a batch of candidates out to a set of critics."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Sequence
6
+
7
+ from pydantic import BaseModel
8
+
9
+ from probative.core.critic import Finding
10
+ from probative.critics.base import Critic
11
+
12
+
13
+ def run_critics(critics: Sequence[Critic], candidates: Sequence[BaseModel]) -> list[Finding]:
14
+ """Run every critic against the candidates its rubric applies to.
15
+
16
+ A rubric's `applies_to` names candidate class names; a candidate is
17
+ passed to a critic only if `type(candidate).__name__` is in that list,
18
+ or the list is empty (meaning "every candidate"). Findings from every
19
+ critic are concatenated in the order `critics` was given.
20
+
21
+ Sequential by design — true parallel fan-out is PB12's LangGraph
22
+ runtime concern, not this framework's.
23
+ """
24
+ findings: list[Finding] = []
25
+ for critic in critics:
26
+ applies_to = critic.rubric.applies_to
27
+ relevant = (
28
+ list(candidates)
29
+ if not applies_to
30
+ else [c for c in candidates if type(c).__name__ in applies_to]
31
+ )
32
+ if relevant:
33
+ findings.extend(critic.check(relevant))
34
+ return findings
@@ -0,0 +1,50 @@
1
+ """Deterministic dimension scoring (PROBATIVE_PHASE_SPECS.md PB3 "known
2
+ unknown", resolved): floor-based, not a weighted mean.
3
+
4
+ A `block`-severity finding is a veto (docs/DESIGN.md §9.1) and must not be
5
+ averaged away by unrelated clean checks in the same rubric, so it collapses
6
+ the dimension's score outright rather than merely discounting it.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from collections.abc import Sequence
12
+
13
+ from probative.core.critic import DimensionScore, Finding, Rubric, Severity
14
+
15
+ _CEILING = 10.0
16
+ _FLOOR = 0.0
17
+ _WARN_PENALTY = 2.0
18
+ _NOTE_PENALTY = 0.5
19
+
20
+
21
+ def score_dimension(rubric: Rubric, findings: Sequence[Finding]) -> DimensionScore:
22
+ """Score one rubric's dimension from `findings` (which may include other
23
+ critics' findings — only those with `critic_id == rubric.id` count).
24
+
25
+ Any `block`-severity finding among them floors the score at 0.0 and sets
26
+ `blocked`. Otherwise the score starts at a ceiling of 10.0 and is
27
+ discounted 2.0 per `warn` finding and 0.5 per `note` finding, floored at
28
+ 0.0 — a `blocked=False` dimension can still reach 0.0 by accumulation,
29
+ which is a different fact from an actual veto and is reported as such.
30
+ """
31
+ own = [f for f in findings if f.critic_id == rubric.id]
32
+ blocked = any(f.severity == Severity.BLOCK for f in own)
33
+ if blocked:
34
+ score = _FLOOR
35
+ else:
36
+ warns = sum(1 for f in own if f.severity == Severity.WARN)
37
+ notes = sum(1 for f in own if f.severity == Severity.NOTE)
38
+ score = max(_FLOOR, _CEILING - _WARN_PENALTY * warns - _NOTE_PENALTY * notes)
39
+ return DimensionScore(
40
+ critic_id=rubric.id,
41
+ invariant=rubric.invariant,
42
+ blocked=blocked,
43
+ score=score,
44
+ findings=own,
45
+ )
46
+
47
+
48
+ def aggregate(rubrics: Sequence[Rubric], findings: Sequence[Finding]) -> list[DimensionScore]:
49
+ """One `DimensionScore` per rubric, in the order `rubrics` was given."""
50
+ return [score_dimension(rubric, findings) for rubric in rubrics]