@cratis/pi 7.190.2 → 7.191.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.
- package/package/corpus/harnesses/copilot/instructions/authoring-skills.instructions.md +9 -1
- package/package/corpus/harnesses/copilot/instructions/code-health.instructions.md +10 -12
- package/package/corpus/harnesses/copilot/instructions/criticality-tiers.instructions.md +39 -0
- package/package/corpus/harnesses/copilot/instructions/framework.instructions.md +2 -2
- package/package/corpus/harnesses/copilot/instructions/pull-requests.instructions.md +3 -2
- package/package/corpus/harnesses/copilot/instructions/review-reports.instructions.md +7 -4
- package/package/corpus/harnesses/copilot/instructions/specs.instructions.md +3 -0
- package/package/corpus/harnesses/copilot/instructions/verification-discipline.instructions.md +9 -13
- package/package/corpus/rules/authoring-skills.md +9 -1
- package/package/corpus/rules/code-health.md +10 -12
- package/package/corpus/rules/codescene.md +4 -4
- package/package/corpus/rules/criticality-tiers.md +38 -0
- package/package/corpus/rules/framework.md +2 -2
- package/package/corpus/rules/general.md +5 -8
- package/package/corpus/rules/local-verification-and-delivery.md +2 -2
- package/package/corpus/rules/pull-requests.md +3 -2
- package/package/corpus/rules/review-reports.md +7 -4
- package/package/corpus/rules/specs.md +3 -0
- package/package/corpus/rules/verification-discipline.md +9 -13
- package/package/corpus/skills/cratis-engineering-ci-gates/SKILL.md +27 -4
- package/package.json +1 -1
|
@@ -17,6 +17,8 @@ paths:
|
|
|
17
17
|
|
|
18
18
|
Trigger (when to use / when not) · the how (steps, patterns, one minimal correct example each) · choosing (use X when…, not Y) · pitfalls (with the diagnostic code you'll see) · verification (command + what a pass looks like). Timeless: describe current behavior without saying it is current.
|
|
19
19
|
|
|
20
|
+
Write for the class of task, not the run the skill came from. Keep that run as evaluation evidence, but strip its repository, file names and one-off examples; a skill fitted to its origin fails on the next task.
|
|
21
|
+
|
|
20
22
|
A code-breaking prerequisite belongs in one `Requires` line with the version-check command and the fallback. This is a compatibility gate, not a release history. Use American English in authored text.
|
|
21
23
|
|
|
22
24
|
## 2. Frontmatter and routing
|
|
@@ -54,7 +56,11 @@ Keep pins in `product-sync.json` and compatibility documentation under `Document
|
|
|
54
56
|
|
|
55
57
|
## 5. Instruction style
|
|
56
58
|
|
|
57
|
-
Give one default and the condition for choosing an alternative, rather than an equal-options menu. Put the reason beside an absolute so the agent can recognize its boundary; volume and ALL-CAPS add no evidence. Prefer concrete, checkable directions over vague quality requests. Use the terms in [glossary.md](./glossary.instructions.md); define an unfamiliar term on first use to avoid competing meanings.
|
|
59
|
+
Give one default and the condition for choosing an alternative, rather than an equal-options menu. Put the reason beside an absolute so the agent can recognize its boundary; volume and ALL-CAPS add no evidence. Prefer concrete, checkable directions over vague quality requests. Use the terms in [glossary.md](./glossary.instructions.md); define an unfamiliar term on first use to avoid competing meanings. Prefer a compact term the model already knows (*tracer bullet*, *red/green*, *vertical slice*) to explaining the concept; a new Cratis term is defined once in `glossary.md`.
|
|
60
|
+
|
|
61
|
+
Give every workflow step an observable done-condition (a file exists, a command passes, a named check returns a value). A step without one invites premature completion: the agent stops when the step looks plausible, not when it is done.
|
|
62
|
+
|
|
63
|
+
Prune by behavior, not length. For each sentence ask whether deleting it would change what the agent does; if not, it is a no-op and the whole sentence goes, rather than trimming its words. Explanations of what the model already knows are the usual no-ops. Never shorten by cutting steps, conditions or examples that change behavior, and settle disagreements by running the skill or its evaluations, not by argument. Show one minimal correct example per pattern and an exact verification command with the observable pass condition.
|
|
58
64
|
|
|
59
65
|
## 6. One source of truth
|
|
60
66
|
|
|
@@ -80,6 +86,7 @@ When changing a description, run trigger evaluations before and after when autho
|
|
|
80
86
|
- Body has headroom; every reference, asset and script is directly named; long references have Contents.
|
|
81
87
|
- Text is timeless; no research-only pages or verified-source headings remain.
|
|
82
88
|
- Defaults, escape conditions, adjacent reasons, glossary terms and correct examples are clear.
|
|
89
|
+
- Every workflow step has an observable done-condition; no sentence fails the no-op test; examples fit the class of task, not the run the skill came from.
|
|
83
90
|
- Rules are linked, not duplicated; MCP server and native naming are resolved.
|
|
84
91
|
- Mechanical steps use scripts where warranted; verification names the command and pass condition.
|
|
85
92
|
- Evaluation inputs cover positive and near-miss routing and baseline output behavior; report any runs not performed.
|
|
@@ -96,6 +103,7 @@ Use path-scoped rules for file-specific invariants and skills for particular ope
|
|
|
96
103
|
## Sources
|
|
97
104
|
|
|
98
105
|
- https://agentskills.io/specification
|
|
106
|
+
- https://www.aihero.dev/skills-writing-for-agents
|
|
99
107
|
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
|
|
100
108
|
- https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md
|
|
101
109
|
- https://code.claude.com/docs/en/memory
|
|
@@ -15,29 +15,27 @@ paths:
|
|
|
15
15
|
|
|
16
16
|
# Code Health floor
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
tools and tool-output handling
|
|
18
|
+
Apply [criticality tiers](./criticality-tiers.instructions.md) first: score Tier A code and
|
|
19
|
+
maintained Tier B code when CodeScene is available. Tier C requires no scoring or
|
|
20
|
+
uplift. Without tools or an account, report that and continue; never block.
|
|
21
|
+
MCP setup, approval-gated tools and tool-output handling: [codescene.md](../../../rules/codescene.md).
|
|
22
22
|
|
|
23
23
|
## The floor
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- If that is too large for the task (a red or yellow legacy file), raise it as far as is safe, report before and after, and add the file to the repository's Code Health uplift issue ("Code Health: raise all files to 9.5"; create it if none exists).
|
|
28
|
-
- Urgent security and production fixes may ship below 9.5, but report the gap and file the uplift.
|
|
25
|
+
- In-scope code ends at Code Health **9.5 or higher**; new code aims for 10. A touched file never declines.
|
|
26
|
+
- Uplift safely with behavior-preserving refactoring and specs. A narrow fix does not require unrelated legacy uplift. If 9.5 exceeds safe scope, report the gap and suggest a follow-up; do not widen the change.
|
|
29
27
|
- Never refactor generated code. A "could not determine" Code Health score is not a failure. Other Cratis rules win over a finding.
|
|
30
28
|
- CodeScene has no floor setting, so the check is ours.
|
|
31
29
|
|
|
32
30
|
## Checking
|
|
33
31
|
|
|
34
|
-
-
|
|
32
|
+
- For in-scope code, run `code_health_review` while shaping it, `code_health_score` before delivery, then `pre_commit_code_health_safeguard` (or `analyze_change_set` against the base branch).
|
|
35
33
|
- The delivery report has a table: file, score before, score after; name each exception with its reason.
|
|
36
34
|
|
|
37
35
|
## No fix loops
|
|
38
36
|
|
|
39
|
-
- **Once, before the gate.** Handle Code Health once per
|
|
37
|
+
- **Once, before the gate.** Handle Code Health once per in-scope file: review while shaping the code (design for the score, do not write first and fix later), refactor, then one `code_health_score`. The gate and review then run once on the final shape.
|
|
40
38
|
- **Never a cycle.** No gate, score, refactor, gate loops. A score check never triggers an extra build or test run on its own; batch score fixes with the other fixes.
|
|
41
|
-
- **One refactor pass per file per change.** If it does not reach 9.5, report
|
|
42
|
-
- **A reported reason closes the item.** Reviewers flag only
|
|
39
|
+
- **One refactor pass per file per change.** If it does not reach 9.5, report before/after and the reason, suggest the uplift follow-up, and stop.
|
|
40
|
+
- **A reported reason closes the item.** Reviewers flag only an in-scope file below 9.5 with no reason, together with the round's other findings, never as a review round of its own.
|
|
43
41
|
- **A second Code Health round is itself a finding.** Name the cause (wrong approach, file too large for the task, tool problem) instead of iterating.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*"
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*"
|
|
5
|
+
---
|
|
6
|
+
<!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
|
|
7
|
+
|
|
8
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
9
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
10
|
+
|
|
11
|
+
# Criticality tiers
|
|
12
|
+
|
|
13
|
+
Judgment-shaped: classify by failure consequences, not repository name.
|
|
14
|
+
|
|
15
|
+
- **Tier A — Critical:** product runtime, auth/credentials, data integrity/migrations,
|
|
16
|
+
production deployment or automation able to disrupt all CI. Require focused
|
|
17
|
+
behavior/rejection specs, independent review and security/product CI. Full local gates
|
|
18
|
+
run only for changed inputs/dependency closure; reuse valid unchanged-input results.
|
|
19
|
+
- **Tier B — Operational but bounded:** internal tooling with limited, recoverable
|
|
20
|
+
impact (e.g. ordinary runner management). Require bounded smoke/regression checks
|
|
21
|
+
for meaningful behavior; review elevated permissions, broad impact or the escalation
|
|
22
|
+
below. No unrelated product gate; Code Health only for maintained, non-disposable code.
|
|
23
|
+
- **Tier C — Disposable or advisory:** noncritical dashboards, reports, local helpers,
|
|
24
|
+
demos/samples, experiments, prose and corpus style checks. No mandatory new specs,
|
|
25
|
+
review/artifacts, Code Health scoring/uplift or full local gate. Smoke checks are
|
|
26
|
+
optional absent specific failure risk; cheap checks may remain, cosmetics are advisory.
|
|
27
|
+
|
|
28
|
+
A change in any tier that touches credentials or secrets, authentication or authorization,
|
|
29
|
+
workflow permissions or untrusted-PR triggers (`pull_request_target`, `workflow_run`,
|
|
30
|
+
forked-PR inputs), data exposure, a trust boundary, or a destructive or irreversible action
|
|
31
|
+
is Tier A for that part and needs independent review, whatever the tool's tier.
|
|
32
|
+
Critical subcomponents inherit Tier A; unknown critical dependencies fail closed to
|
|
33
|
+
the higher tier. Narrow fixes need no unrelated legacy uplift. No artifacts needed
|
|
34
|
+
to claim a tier.
|
|
35
|
+
|
|
36
|
+
Security, secrets, authorization, destructive-action safeguards and required CI
|
|
37
|
+
status-check contracts remain binding. Irrelevant CI execution must report explicit
|
|
38
|
+
success/not-applicable rather than leave a required check pending; preserve required
|
|
39
|
+
product/integration coverage until a validated narrower replacement exists.
|
|
@@ -59,8 +59,8 @@ Repo conventions follow from this: `Source/DotNET` + `Source/JavaScript` for dua
|
|
|
59
59
|
|
|
60
60
|
## Quality gates (framework)
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
62
|
+
- Select gates by [criticality tier](./criticality-tiers.instructions.md), changed inputs and dependency closure; these product gates are not a blanket local mandate for tooling or prose.
|
|
63
|
+
- Applicable Debug/Release builds have **zero warnings, zero errors**; specs in scope pass (built C# spec executables; VSTest only: `dotnet test <project> --no-build`; TS package tests; Components also `build-storybook`).
|
|
64
64
|
- For public-facing changes (APIs, attributes, generated output, component props): update the product documentation and verify it.
|
|
65
65
|
- Match the repo's existing patterns; when a deep architectural question isn't answered by the universal rules or this file, consult the **repo's own docs/CONTRIBUTING** or ask — do not infer framework internals from a single call site.
|
|
66
66
|
|
|
@@ -5,7 +5,7 @@ applyTo: "**/*"
|
|
|
5
5
|
|
|
6
6
|
# How to Do Pull Requests
|
|
7
7
|
|
|
8
|
-
**Before writing any commit message, committing, pushing, or creating/editing a PR, read the `cratis-commits-and-pull-requests` skill.**
|
|
8
|
+
**Before writing any commit message, committing, pushing, or creating/editing a PR, read the `cratis-commits-and-pull-requests` skill.** Commit rules: [git-commits.md](./git-commits.instructions.md).
|
|
9
9
|
|
|
10
10
|
## The description is the release note
|
|
11
11
|
|
|
@@ -33,5 +33,6 @@ applyTo: "**/*"
|
|
|
33
33
|
## Before you create or edit a PR
|
|
34
34
|
|
|
35
35
|
- Run `node .cratis/ai/hooks/scripts/cratis-check-pr.mjs --body-file <file> --label <intent>`; it applies the exact `policy / verify` release-note rules and the Bash hook runs it on `gh pr create` and `gh pr edit`. If it fails, fix the description, not the code. Before every body edit, run `git diff --stat origin/main...HEAD` and delete bullets the diff no longer supports.
|
|
36
|
-
- Run the affected-project gates before marking work ready
|
|
36
|
+
- Run the affected-project gates before marking work ready. Scope gates and independent review by [criticality tier](./criticality-tiers.instructions.md) and affected inputs/dependencies; reuse valid unchanged-input results. When specs run, use built spec runners.
|
|
37
|
+
- Run the repository's required CI checks after an authorized push. Of all labels and PR types, none is a blanket exemption from red CI. Irrelevant checks report success/not-applicable, never pending.
|
|
37
38
|
- The release train is the PR: fold finished branches into the repository's one train (see the skill). Open it once, when verified, as the orchestrator (`cratis-engineering-release-trains`) with `--assignee @me`. Split only for a named major, an urgent security fix authorized in writing, or an accepted outsider issue (patch or minor, own release).
|
|
@@ -14,6 +14,10 @@ paths:
|
|
|
14
14
|
|
|
15
15
|
# Shared review reports
|
|
16
16
|
|
|
17
|
+
[Criticality tiers](./criticality-tiers.instructions.md) determine when independent review is
|
|
18
|
+
required; Tier C needs no review or review document. The following governs requested
|
|
19
|
+
or required reviews.
|
|
20
|
+
|
|
17
21
|
Use this report shape for code, security, performance, and repository-investigation
|
|
18
22
|
reviews. Domain-specific risk labels refine findings, not the report or verdict
|
|
19
23
|
vocabulary. Review the change within the declared scope, not unrelated existing debt.
|
|
@@ -86,10 +90,9 @@ See `cratis-engineering-review-rounds` for dispatch and writer-pause mechanics.
|
|
|
86
90
|
|
|
87
91
|
An uncited behavior change on a trust-boundary or wire/protocol surface is a blocker (`published-contracts.md`).
|
|
88
92
|
|
|
89
|
-
Code Health (`code-health.md`)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
names its cause.
|
|
93
|
+
Code Health (`code-health.md`) applies only within the tier's scope and never earns
|
|
94
|
+
a round of its own. Flag an in-scope file below 9.5 without a reason alongside other
|
|
95
|
+
findings; a reported reason closes it. A second Code Health round is a finding.
|
|
93
96
|
|
|
94
97
|
## Reviewer independence
|
|
95
98
|
|
|
@@ -8,6 +8,9 @@ paths:
|
|
|
8
8
|
|
|
9
9
|
# How to Write Specs
|
|
10
10
|
|
|
11
|
+
[Criticality tiers](./criticality-tiers.instructions.md) determine when specs are required.
|
|
12
|
+
The conventions below govern writing specs, not whether every change needs them.
|
|
13
|
+
|
|
11
14
|
We call automated tests **specs** (specifications), not tests. This is deliberate — specs are executable documentation that describe what the system *does*, written in the language of the domain. A new developer should be able to read the spec folder structure like a table of contents and understand the system's behavior without opening a single source file.
|
|
12
15
|
|
|
13
16
|
This philosophy comes from Specification by Example and BDD (Behavior Driven Development). The goal is human-readable, navigable specifications that double as a living contract.
|
package/package/corpus/harnesses/copilot/instructions/verification-discipline.instructions.md
CHANGED
|
@@ -10,20 +10,16 @@ paths:
|
|
|
10
10
|
Verification answers whether changed behavior works. It does not establish who
|
|
11
11
|
authored a file or preserve a chain of evidence about how it arrived.
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
- Run one phase per command with its real exit status
|
|
15
|
-
- **[contract] Never iterate through CI:** never push to see failures
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- Fast feedback is a product requirement: a spec takes milliseconds, the suite seconds; specs share setup and run in parallel; analyzers must not halt builds. CI builds the spec path without analyzers and enforces them, warnings as errors, in a parallel required job; the pre-push gate runs them. A slowdown is a defect.
|
|
19
|
-
- Add a focused specification for every behavior or rejection rule you change.
|
|
13
|
+
- Select specs, review and local checks by [criticality tier](./criticality-tiers.instructions.md).
|
|
14
|
+
- Run one bounded phase per command with its real exit status; stop on failure. Read **cratis-engineering-ci-gates** for deadlines, phase selection and diagnostic handling.
|
|
15
|
+
- **[contract] Never iterate through CI:** never push to see failures; reproduce relevant CI failures locally. Run applicable local gates before pushing; required product/integration CI still passes before merge. Integration may wait for CI only when repository policy permits and CI enforces it; call it deferred, never a local pass. Required coverage without local proof or enforced CI is unverified. On a shared machine cap parallelism, one heavy phase at once (`cratis-engineering-ci-gates`).
|
|
16
|
+
- Never use filtered build/test output or printed zero-error counts as gate evidence; preserve the producer's exit status and needed diagnostics in `.ai-work/`.
|
|
17
|
+
- Keep specs fast; follow [fast-feedback.md](./fast-feedback.instructions.md).
|
|
20
18
|
- Keep each check deterministic and runnable locally and in CI.
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
is not produced unless a repository workflow (such as a governed release) or
|
|
26
|
-
the user asks for it. The check's own output is the evidence.
|
|
19
|
+
- Check output is evidence; checksums, inventories, receipts, ledgers, attestations,
|
|
20
|
+
snapshots, escrow copies and provenance records cannot replace behavior checks.
|
|
21
|
+
Do not produce these or ad-hoc `verify-*` scripts unless a repository workflow or
|
|
22
|
+
the user asks.
|
|
27
23
|
- Report the conclusion and any real uncertainty in a line or two, not the
|
|
28
24
|
audit trail. Show the output when asked, when a claim is contested, or when
|
|
29
25
|
the check failed. Report failures and skipped checks honestly.
|
|
@@ -16,6 +16,8 @@ paths:
|
|
|
16
16
|
|
|
17
17
|
Trigger (when to use / when not) · the how (steps, patterns, one minimal correct example each) · choosing (use X when…, not Y) · pitfalls (with the diagnostic code you'll see) · verification (command + what a pass looks like). Timeless: describe current behavior without saying it is current.
|
|
18
18
|
|
|
19
|
+
Write for the class of task, not the run the skill came from. Keep that run as evaluation evidence, but strip its repository, file names and one-off examples; a skill fitted to its origin fails on the next task.
|
|
20
|
+
|
|
19
21
|
A code-breaking prerequisite belongs in one `Requires` line with the version-check command and the fallback. This is a compatibility gate, not a release history. Use American English in authored text.
|
|
20
22
|
|
|
21
23
|
## 2. Frontmatter and routing
|
|
@@ -53,7 +55,11 @@ Keep pins in `product-sync.json` and compatibility documentation under `Document
|
|
|
53
55
|
|
|
54
56
|
## 5. Instruction style
|
|
55
57
|
|
|
56
|
-
Give one default and the condition for choosing an alternative, rather than an equal-options menu. Put the reason beside an absolute so the agent can recognize its boundary; volume and ALL-CAPS add no evidence. Prefer concrete, checkable directions over vague quality requests. Use the terms in [glossary.md](./glossary.md); define an unfamiliar term on first use to avoid competing meanings.
|
|
58
|
+
Give one default and the condition for choosing an alternative, rather than an equal-options menu. Put the reason beside an absolute so the agent can recognize its boundary; volume and ALL-CAPS add no evidence. Prefer concrete, checkable directions over vague quality requests. Use the terms in [glossary.md](./glossary.md); define an unfamiliar term on first use to avoid competing meanings. Prefer a compact term the model already knows (*tracer bullet*, *red/green*, *vertical slice*) to explaining the concept; a new Cratis term is defined once in `glossary.md`.
|
|
59
|
+
|
|
60
|
+
Give every workflow step an observable done-condition (a file exists, a command passes, a named check returns a value). A step without one invites premature completion: the agent stops when the step looks plausible, not when it is done.
|
|
61
|
+
|
|
62
|
+
Prune by behavior, not length. For each sentence ask whether deleting it would change what the agent does; if not, it is a no-op and the whole sentence goes, rather than trimming its words. Explanations of what the model already knows are the usual no-ops. Never shorten by cutting steps, conditions or examples that change behavior, and settle disagreements by running the skill or its evaluations, not by argument. Show one minimal correct example per pattern and an exact verification command with the observable pass condition.
|
|
57
63
|
|
|
58
64
|
## 6. One source of truth
|
|
59
65
|
|
|
@@ -79,6 +85,7 @@ When changing a description, run trigger evaluations before and after when autho
|
|
|
79
85
|
- Body has headroom; every reference, asset and script is directly named; long references have Contents.
|
|
80
86
|
- Text is timeless; no research-only pages or verified-source headings remain.
|
|
81
87
|
- Defaults, escape conditions, adjacent reasons, glossary terms and correct examples are clear.
|
|
88
|
+
- Every workflow step has an observable done-condition; no sentence fails the no-op test; examples fit the class of task, not the run the skill came from.
|
|
82
89
|
- Rules are linked, not duplicated; MCP server and native naming are resolved.
|
|
83
90
|
- Mechanical steps use scripts where warranted; verification names the command and pass condition.
|
|
84
91
|
- Evaluation inputs cover positive and near-miss routing and baseline output behavior; report any runs not performed.
|
|
@@ -95,6 +102,7 @@ Use path-scoped rules for file-specific invariants and skills for particular ope
|
|
|
95
102
|
## Sources
|
|
96
103
|
|
|
97
104
|
- https://agentskills.io/specification
|
|
105
|
+
- https://www.aihero.dev/skills-writing-for-agents
|
|
98
106
|
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
|
|
99
107
|
- https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md
|
|
100
108
|
- https://code.claude.com/docs/en/memory
|
|
@@ -14,29 +14,27 @@ paths:
|
|
|
14
14
|
|
|
15
15
|
# Code Health floor
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
tools and tool-output handling
|
|
17
|
+
Apply [criticality tiers](./criticality-tiers.md) first: score Tier A code and
|
|
18
|
+
maintained Tier B code when CodeScene is available. Tier C requires no scoring or
|
|
19
|
+
uplift. Without tools or an account, report that and continue; never block.
|
|
20
|
+
MCP setup, approval-gated tools and tool-output handling: [codescene.md](./codescene.md).
|
|
21
21
|
|
|
22
22
|
## The floor
|
|
23
23
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- If that is too large for the task (a red or yellow legacy file), raise it as far as is safe, report before and after, and add the file to the repository's Code Health uplift issue ("Code Health: raise all files to 9.5"; create it if none exists).
|
|
27
|
-
- Urgent security and production fixes may ship below 9.5, but report the gap and file the uplift.
|
|
24
|
+
- In-scope code ends at Code Health **9.5 or higher**; new code aims for 10. A touched file never declines.
|
|
25
|
+
- Uplift safely with behavior-preserving refactoring and specs. A narrow fix does not require unrelated legacy uplift. If 9.5 exceeds safe scope, report the gap and suggest a follow-up; do not widen the change.
|
|
28
26
|
- Never refactor generated code. A "could not determine" Code Health score is not a failure. Other Cratis rules win over a finding.
|
|
29
27
|
- CodeScene has no floor setting, so the check is ours.
|
|
30
28
|
|
|
31
29
|
## Checking
|
|
32
30
|
|
|
33
|
-
-
|
|
31
|
+
- For in-scope code, run `code_health_review` while shaping it, `code_health_score` before delivery, then `pre_commit_code_health_safeguard` (or `analyze_change_set` against the base branch).
|
|
34
32
|
- The delivery report has a table: file, score before, score after; name each exception with its reason.
|
|
35
33
|
|
|
36
34
|
## No fix loops
|
|
37
35
|
|
|
38
|
-
- **Once, before the gate.** Handle Code Health once per
|
|
36
|
+
- **Once, before the gate.** Handle Code Health once per in-scope file: review while shaping the code (design for the score, do not write first and fix later), refactor, then one `code_health_score`. The gate and review then run once on the final shape.
|
|
39
37
|
- **Never a cycle.** No gate, score, refactor, gate loops. A score check never triggers an extra build or test run on its own; batch score fixes with the other fixes.
|
|
40
|
-
- **One refactor pass per file per change.** If it does not reach 9.5, report
|
|
41
|
-
- **A reported reason closes the item.** Reviewers flag only
|
|
38
|
+
- **One refactor pass per file per change.** If it does not reach 9.5, report before/after and the reason, suggest the uplift follow-up, and stop.
|
|
39
|
+
- **A reported reason closes the item.** Reviewers flag only an in-scope file below 9.5 with no reason, together with the round's other findings, never as a review round of its own.
|
|
42
40
|
- **A second Code Health round is itself a finding.** Name the cause (wrong approach, file too large for the task, tool problem) instead of iterating.
|
|
@@ -15,10 +15,10 @@ not opted in.
|
|
|
15
15
|
|
|
16
16
|
## Thresholds and checking
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
no-fix-loops process are
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
Scope follows [criticality tiers](./criticality-tiers.md); the floor, checking steps
|
|
19
|
+
and no-fix-loops process are in [code-health.md](./code-health.md). Tier C requires
|
|
20
|
+
no Code Health scoring or uplift; a narrow fix does not require unrelated legacy uplift.
|
|
21
|
+
Vendored refactoring instructions do not expand that scope.
|
|
22
22
|
|
|
23
23
|
CodeScene categories, for reference: **10 optimal**, **9–9.9 green**, **4–8.9 yellow**,
|
|
24
24
|
**1–3.9 red**. Project target: **Hotspot Code Health at least 9**, with no downward trend.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*"
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
8
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
9
|
+
|
|
10
|
+
# Criticality tiers
|
|
11
|
+
|
|
12
|
+
Judgment-shaped: classify by failure consequences, not repository name.
|
|
13
|
+
|
|
14
|
+
- **Tier A — Critical:** product runtime, auth/credentials, data integrity/migrations,
|
|
15
|
+
production deployment or automation able to disrupt all CI. Require focused
|
|
16
|
+
behavior/rejection specs, independent review and security/product CI. Full local gates
|
|
17
|
+
run only for changed inputs/dependency closure; reuse valid unchanged-input results.
|
|
18
|
+
- **Tier B — Operational but bounded:** internal tooling with limited, recoverable
|
|
19
|
+
impact (e.g. ordinary runner management). Require bounded smoke/regression checks
|
|
20
|
+
for meaningful behavior; review elevated permissions, broad impact or the escalation
|
|
21
|
+
below. No unrelated product gate; Code Health only for maintained, non-disposable code.
|
|
22
|
+
- **Tier C — Disposable or advisory:** noncritical dashboards, reports, local helpers,
|
|
23
|
+
demos/samples, experiments, prose and corpus style checks. No mandatory new specs,
|
|
24
|
+
review/artifacts, Code Health scoring/uplift or full local gate. Smoke checks are
|
|
25
|
+
optional absent specific failure risk; cheap checks may remain, cosmetics are advisory.
|
|
26
|
+
|
|
27
|
+
A change in any tier that touches credentials or secrets, authentication or authorization,
|
|
28
|
+
workflow permissions or untrusted-PR triggers (`pull_request_target`, `workflow_run`,
|
|
29
|
+
forked-PR inputs), data exposure, a trust boundary, or a destructive or irreversible action
|
|
30
|
+
is Tier A for that part and needs independent review, whatever the tool's tier.
|
|
31
|
+
Critical subcomponents inherit Tier A; unknown critical dependencies fail closed to
|
|
32
|
+
the higher tier. Narrow fixes need no unrelated legacy uplift. No artifacts needed
|
|
33
|
+
to claim a tier.
|
|
34
|
+
|
|
35
|
+
Security, secrets, authorization, destructive-action safeguards and required CI
|
|
36
|
+
status-check contracts remain binding. Irrelevant CI execution must report explicit
|
|
37
|
+
success/not-applicable rather than leave a required check pending; preserve required
|
|
38
|
+
product/integration coverage until a validated narrower replacement exists.
|
|
@@ -58,8 +58,8 @@ Repo conventions follow from this: `Source/DotNET` + `Source/JavaScript` for dua
|
|
|
58
58
|
|
|
59
59
|
## Quality gates (framework)
|
|
60
60
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
61
|
+
- Select gates by [criticality tier](./criticality-tiers.md), changed inputs and dependency closure; these product gates are not a blanket local mandate for tooling or prose.
|
|
62
|
+
- Applicable Debug/Release builds have **zero warnings, zero errors**; specs in scope pass (built C# spec executables; VSTest only: `dotnet test <project> --no-build`; TS package tests; Components also `build-storybook`).
|
|
63
63
|
- For public-facing changes (APIs, attributes, generated output, component props): update the product documentation and verify it.
|
|
64
64
|
- Match the repo's existing patterns; when a deep architectural question isn't answered by the universal rules or this file, consult the **repo's own docs/CONTRIBUTING** or ask — do not infer framework internals from a single call site.
|
|
65
65
|
|
|
@@ -90,11 +90,10 @@ the plugin marketplaces) are in [ai-distribution.md](./ai-distribution.md):
|
|
|
90
90
|
|
|
91
91
|
## Verification Discipline
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Verify claims with build, spec, lint or observed-behavior signals, not confidence.
|
|
94
94
|
|
|
95
95
|
- **Confirm "done"/"fixed"/"correct" against a fresh signal — never self-assessment.** Run the relevant gate and observe it pass *this time*.
|
|
96
|
-
- **
|
|
97
|
-
- **Gate configuration:** shipped defaults `.cratis/ai/hooks/scripts/quality-gates.json`; project overrides `.cratis/ai/quality-gates.project.json` shallow-merge by gate id (command without requires drops inherited packageScripts). `CRATIS_HOOKS_GATES` replaces defaults; project overrides still apply.
|
|
96
|
+
- **Scope checks by [criticality tier](./criticality-tiers.md);** follow [verification-discipline.md](./verification-discipline.md) for execution and evidence.
|
|
98
97
|
- **A green build is not behavioral correctness.** Compilation proves it builds, not that the slice does the right thing — that's what specs and exercising the UI are for.
|
|
99
98
|
- **Incidents:** analyse the cause first; choose the narrowest fix for it; state its cost and when it can be removed (**cratis-engineering-post-mortem**).
|
|
100
99
|
- **Report the conclusion and what you didn't verify, in a line or two.** Show output when asked, contested or failed — see [verification-discipline.md](./verification-discipline.md).
|
|
@@ -118,10 +117,8 @@ A claim is only as good as the signal behind it — a build result, a test run,
|
|
|
118
117
|
|
|
119
118
|
## Definition of Done
|
|
120
119
|
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
- For public-facing changes (clients, SDKs, public APIs, developer-facing behavior), documentation is added or updated and its verification passes.
|
|
124
|
-
- When CodeScene tools are available, touched files end at Code Health >= 9.5 and never decline; handle it once, before the gate, and report before/after (`code-health.md`).
|
|
120
|
+
- Within the [tier's scope](./criticality-tiers.md), builds have zero warnings/errors, specs pass and [Code Health](./code-health.md) shortfalls are reported.
|
|
121
|
+
- For public-facing behavior, update documentation and verify it.
|
|
125
122
|
|
|
126
123
|
## Where to Look
|
|
127
124
|
|
|
@@ -141,7 +138,7 @@ A claim is only as good as the signal behind it — a build result, a test run,
|
|
|
141
138
|
| Build and spec-run speed: parallel-safe specs, no per-spec startup, cheap analyzers | `fast-feedback.md` |
|
|
142
139
|
| Spec patterns — the four `*Scenario` helpers (application only) | `specs.scenarios.csharp.md` |
|
|
143
140
|
| Strongly-typed values (`ConceptAs<T>`, `EventSourceId<T>`); shared term definitions (event, projection, reducer, reactor, observer, DCB, …) | `concepts.md`; `glossary.md` |
|
|
144
|
-
|
|
|
141
|
+
| Specs, review, Code Health and local gate scope; trust boundaries and wire/protocol contracts | `criticality-tiers.md`; `code-health.md`; `published-contracts.md` |
|
|
145
142
|
| OpenTelemetry traces, metrics and telemetry code | `observability.md` |
|
|
146
143
|
| Diagnosing a misbehaving slice | read model stale or startup crash: **cratis-chronicle-projection** (*Startup-crash traps*); reactor paused or quarantined: **cratis-chronicle-reactor** (*Failure behavior*); proxy missing: **cratis-arc-command** (*Generate the TypeScript proxy*) |
|
|
147
144
|
| Inspecting or operating a **running** Chronicle store (failed partitions, replays, browsing events) with the `cratis` CLI | the **cratis-chronicle-cli-operations** and **cratis-cli-terminal-workbench** skills |
|
|
@@ -6,6 +6,6 @@ profile: cratis/engineering
|
|
|
6
6
|
|
|
7
7
|
CI/CD is shared and finite: it confirms, it is not a feedback loop.
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- Push and open a PR only when
|
|
9
|
+
- Use [criticality tiers](./criticality-tiers.md) for local gates; reuse valid unchanged-input results. Never push as a feedback loop; reproduce relevant CI failures locally.
|
|
10
|
+
- Push and open a PR only when applicable checks pass for its inputs. Required CI remains binding. No draft, placeholder or WIP PRs.
|
|
11
11
|
- One PR per repository. As orchestrator, brief sub-agents to commit verified work to the shared branch and never push or open a PR; you verify the combination and open the one PR ([pull-requests.md](./pull-requests.md) lists the split exceptions).
|
|
@@ -4,7 +4,7 @@ applyTo: "**/*"
|
|
|
4
4
|
|
|
5
5
|
# How to Do Pull Requests
|
|
6
6
|
|
|
7
|
-
**Before writing any commit message, committing, pushing, or creating/editing a PR, read the `cratis-commits-and-pull-requests` skill.**
|
|
7
|
+
**Before writing any commit message, committing, pushing, or creating/editing a PR, read the `cratis-commits-and-pull-requests` skill.** Commit rules: [git-commits.md](./git-commits.md).
|
|
8
8
|
|
|
9
9
|
## The description is the release note
|
|
10
10
|
|
|
@@ -32,5 +32,6 @@ applyTo: "**/*"
|
|
|
32
32
|
## Before you create or edit a PR
|
|
33
33
|
|
|
34
34
|
- Run `node .cratis/ai/hooks/scripts/cratis-check-pr.mjs --body-file <file> --label <intent>`; it applies the exact `policy / verify` release-note rules and the Bash hook runs it on `gh pr create` and `gh pr edit`. If it fails, fix the description, not the code. Before every body edit, run `git diff --stat origin/main...HEAD` and delete bullets the diff no longer supports.
|
|
35
|
-
- Run the affected-project gates before marking work ready
|
|
35
|
+
- Run the affected-project gates before marking work ready. Scope gates and independent review by [criticality tier](./criticality-tiers.md) and affected inputs/dependencies; reuse valid unchanged-input results. When specs run, use built spec runners.
|
|
36
|
+
- Run the repository's required CI checks after an authorized push. Of all labels and PR types, none is a blanket exemption from red CI. Irrelevant checks report success/not-applicable, never pending.
|
|
36
37
|
- The release train is the PR: fold finished branches into the repository's one train (see the skill). Open it once, when verified, as the orchestrator (`cratis-engineering-release-trains`) with `--assignee @me`. Split only for a named major, an urgent security fix authorized in writing, or an accepted outsider issue (patch or minor, own release).
|
|
@@ -13,6 +13,10 @@ paths:
|
|
|
13
13
|
|
|
14
14
|
# Shared review reports
|
|
15
15
|
|
|
16
|
+
[Criticality tiers](./criticality-tiers.md) determine when independent review is
|
|
17
|
+
required; Tier C needs no review or review document. The following governs requested
|
|
18
|
+
or required reviews.
|
|
19
|
+
|
|
16
20
|
Use this report shape for code, security, performance, and repository-investigation
|
|
17
21
|
reviews. Domain-specific risk labels refine findings, not the report or verdict
|
|
18
22
|
vocabulary. Review the change within the declared scope, not unrelated existing debt.
|
|
@@ -85,10 +89,9 @@ See `cratis-engineering-review-rounds` for dispatch and writer-pause mechanics.
|
|
|
85
89
|
|
|
86
90
|
An uncited behavior change on a trust-boundary or wire/protocol surface is a blocker (`published-contracts.md`).
|
|
87
91
|
|
|
88
|
-
Code Health (`code-health.md`)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
names its cause.
|
|
92
|
+
Code Health (`code-health.md`) applies only within the tier's scope and never earns
|
|
93
|
+
a round of its own. Flag an in-scope file below 9.5 without a reason alongside other
|
|
94
|
+
findings; a reported reason closes it. A second Code Health round is a finding.
|
|
92
95
|
|
|
93
96
|
## Reviewer independence
|
|
94
97
|
|
|
@@ -7,6 +7,9 @@ paths:
|
|
|
7
7
|
|
|
8
8
|
# How to Write Specs
|
|
9
9
|
|
|
10
|
+
[Criticality tiers](./criticality-tiers.md) determine when specs are required.
|
|
11
|
+
The conventions below govern writing specs, not whether every change needs them.
|
|
12
|
+
|
|
10
13
|
We call automated tests **specs** (specifications), not tests. This is deliberate — specs are executable documentation that describe what the system *does*, written in the language of the domain. A new developer should be able to read the spec folder structure like a table of contents and understand the system's behavior without opening a single source file.
|
|
11
14
|
|
|
12
15
|
This philosophy comes from Specification by Example and BDD (Behavior Driven Development). The goal is human-readable, navigable specifications that double as a living contract.
|
|
@@ -9,20 +9,16 @@ paths:
|
|
|
9
9
|
Verification answers whether changed behavior works. It does not establish who
|
|
10
10
|
authored a file or preserve a chain of evidence about how it arrived.
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- Run one phase per command with its real exit status
|
|
14
|
-
- **[contract] Never iterate through CI:** never push to see failures
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- Fast feedback is a product requirement: a spec takes milliseconds, the suite seconds; specs share setup and run in parallel; analyzers must not halt builds. CI builds the spec path without analyzers and enforces them, warnings as errors, in a parallel required job; the pre-push gate runs them. A slowdown is a defect.
|
|
18
|
-
- Add a focused specification for every behavior or rejection rule you change.
|
|
12
|
+
- Select specs, review and local checks by [criticality tier](./criticality-tiers.md).
|
|
13
|
+
- Run one bounded phase per command with its real exit status; stop on failure. Read **cratis-engineering-ci-gates** for deadlines, phase selection and diagnostic handling.
|
|
14
|
+
- **[contract] Never iterate through CI:** never push to see failures; reproduce relevant CI failures locally. Run applicable local gates before pushing; required product/integration CI still passes before merge. Integration may wait for CI only when repository policy permits and CI enforces it; call it deferred, never a local pass. Required coverage without local proof or enforced CI is unverified. On a shared machine cap parallelism, one heavy phase at once (`cratis-engineering-ci-gates`).
|
|
15
|
+
- Never use filtered build/test output or printed zero-error counts as gate evidence; preserve the producer's exit status and needed diagnostics in `.ai-work/`.
|
|
16
|
+
- Keep specs fast; follow [fast-feedback.md](./fast-feedback.md).
|
|
19
17
|
- Keep each check deterministic and runnable locally and in CI.
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
is not produced unless a repository workflow (such as a governed release) or
|
|
25
|
-
the user asks for it. The check's own output is the evidence.
|
|
18
|
+
- Check output is evidence; checksums, inventories, receipts, ledgers, attestations,
|
|
19
|
+
snapshots, escrow copies and provenance records cannot replace behavior checks.
|
|
20
|
+
Do not produce these or ad-hoc `verify-*` scripts unless a repository workflow or
|
|
21
|
+
the user asks.
|
|
26
22
|
- Report the conclusion and any real uncertainty in a line or two, not the
|
|
27
23
|
audit trail. Show the output when asked, when a claim is contested, or when
|
|
28
24
|
the check failed. Report failures and skipped checks honestly.
|
|
@@ -11,14 +11,19 @@ compatibility: Requires git and the GitHub CLI (gh).
|
|
|
11
11
|
# Run the gate once, then watch the exact run
|
|
12
12
|
|
|
13
13
|
Operate checks; do not redesign workflows here. Read
|
|
14
|
-
[verification-discipline.md](../../rules/verification-discipline.md) for
|
|
15
|
-
|
|
14
|
+
[verification-discipline.md](../../rules/verification-discipline.md) for verification
|
|
15
|
+
contracts, and
|
|
16
16
|
[pull-requests.md](../cratis-commits-and-pull-requests/references/pr-labels-and-release.md#quality-gates) for required checks.
|
|
17
17
|
Read [capability-is-not-authority.md](../../rules/capability-is-not-authority.md)
|
|
18
18
|
before an external effect. A request to verify does not authorize a push.
|
|
19
19
|
|
|
20
20
|
## Derive the local gate
|
|
21
21
|
|
|
22
|
+
Hook gate configuration: shipped defaults `.cratis/ai/hooks/scripts/quality-gates.json`;
|
|
23
|
+
project overrides `.cratis/ai/quality-gates.project.json` shallow-merge by gate id
|
|
24
|
+
(command without requires drops inherited packageScripts). `CRATIS_HOOKS_GATES`
|
|
25
|
+
replaces defaults; project overrides still apply.
|
|
26
|
+
|
|
22
27
|
1. Read `.github/workflows/` and the repository's tier policy. Follow reusable
|
|
23
28
|
workflows and invoked scripts. Extract commands, solution and test selection,
|
|
24
29
|
configuration, warning settings, analyzers, lint and formatting checks.
|
|
@@ -72,8 +77,26 @@ When several deliveries form one candidate, the assembler runs the final gate
|
|
|
72
77
|
on the assembled state; deliveries bring targeted results. A changed state after
|
|
73
78
|
a failure needs the required gate again.
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
## Phase execution
|
|
81
|
+
|
|
82
|
+
- Budget targeted checks around 120 seconds and build/test phases around 300 seconds;
|
|
83
|
+
explain any longer budget first, and obtain explicit approval before a phase exceeds
|
|
84
|
+
600 seconds. Do not blindly retry or repeat passing tests on unchanged inputs without
|
|
85
|
+
a flaky-test hypothesis or required matrix.
|
|
86
|
+
- Separate status/fetch from builds, Debug from Release, each test project, and frontend
|
|
87
|
+
lint/compile/test/build. Do not combine these into an opaque command with a large
|
|
88
|
+
outer timeout. Expose progress and cancellation; report the precise failed or
|
|
89
|
+
timed-out phase and do not continue dependent phases after failure.
|
|
90
|
+
- Capture the producer's exit status before summarizing output; `pipefail` alone is
|
|
91
|
+
insufficient with early-closing consumers such as `head`. Never use
|
|
92
|
+
`build/test | grep | sort/head/tail` as gate evidence. Printed zero-error counts are
|
|
93
|
+
not proof of success. Preserve needed full diagnostics in task-scoped `.ai-work/`
|
|
94
|
+
logs rather than hiding them in `/tmp`.
|
|
95
|
+
- Fast feedback is a product requirement: a spec takes milliseconds, the suite seconds;
|
|
96
|
+
specs share setup and run in parallel; analyzers must not halt builds. CI builds the
|
|
97
|
+
spec path without analyzers and enforces them, warnings as errors, in a parallel
|
|
98
|
+
required job; the pre-push gate runs them. A slowdown is a defect.
|
|
99
|
+
|
|
77
100
|
Report the exact command and result. Put verification and deferred coverage in
|
|
78
101
|
reviewer comments, not the release-note description.
|
|
79
102
|
|