@cratis/pi 7.100.0 → 7.101.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/agents/backend-developer.md +1 -0
- package/package/corpus/agents/browser-operator.md +44 -0
- package/package/corpus/agents/code-reviewer.md +4 -0
- package/package/corpus/agents/coordinator.md +1 -0
- package/package/corpus/agents/frontend-developer.md +1 -0
- package/package/corpus/agents/orchestrator.md +1 -0
- package/package/corpus/agents/performance-reviewer.md +4 -0
- package/package/corpus/agents/planner.md +1 -0
- package/package/corpus/agents/repository-investigation-reviewer.md +4 -0
- package/package/corpus/agents/repository-investigator.md +1 -0
- package/package/corpus/agents/screenplay-modeler.md +1 -0
- package/package/corpus/agents/screenplay-renderer.md +1 -0
- package/package/corpus/agents/screenplay-reviewer.md +4 -0
- package/package/corpus/agents/security-reviewer.md +4 -0
- package/package/corpus/agents/slice-implementer.md +1 -0
- package/package/corpus/agents/spec-writer.md +1 -0
- package/package/corpus/harnesses/copilot/instructions/browser.instructions.md +46 -0
- package/package/corpus/harnesses/copilot/instructions/local-work-artifacts.instructions.md +3 -0
- package/package/corpus/harnesses/copilot/instructions/review-reports.instructions.md +11 -0
- package/package/corpus/harnesses/copilot/instructions/secrets.instructions.md +35 -0
- package/package/corpus/harnesses/pi/agents/backend-developer.md +1 -0
- package/package/corpus/harnesses/pi/agents/browser-operator.md +41 -0
- package/package/corpus/harnesses/pi/agents/code-reviewer.md +4 -0
- package/package/corpus/harnesses/pi/agents/coordinator.md +1 -0
- package/package/corpus/harnesses/pi/agents/frontend-developer.md +1 -0
- package/package/corpus/harnesses/pi/agents/orchestrator.md +1 -0
- package/package/corpus/harnesses/pi/agents/performance-reviewer.md +4 -0
- package/package/corpus/harnesses/pi/agents/planner.md +1 -0
- package/package/corpus/harnesses/pi/agents/repository-investigation-reviewer.md +4 -0
- package/package/corpus/harnesses/pi/agents/repository-investigator.md +1 -0
- package/package/corpus/harnesses/pi/agents/screenplay-modeler.md +1 -0
- package/package/corpus/harnesses/pi/agents/screenplay-renderer.md +1 -0
- package/package/corpus/harnesses/pi/agents/screenplay-reviewer.md +4 -0
- package/package/corpus/harnesses/pi/agents/security-reviewer.md +4 -0
- package/package/corpus/harnesses/pi/agents/slice-implementer.md +1 -0
- package/package/corpus/harnesses/pi/agents/spec-writer.md +1 -0
- package/package/corpus/harnesses/pi/extensions/cratis-hooks/index.ts +19 -6
- package/package/corpus/harnesses/pi/extensions/cratis-hooks/quality-gate.ts +10 -1
- package/package/corpus/hooks/README.md +8 -0
- package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +458 -0
- package/package/corpus/hooks/settings.template.json +4 -0
- package/package/corpus/rules/browser.md +45 -0
- package/package/corpus/rules/general.md +2 -0
- package/package/corpus/rules/local-work-artifacts.md +3 -0
- package/package/corpus/rules/review-reports.md +11 -0
- package/package/corpus/rules/secrets.md +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Browser Operator
|
|
3
|
+
description: >
|
|
4
|
+
Read-only browser agent. The only agent type given browser tools. Runs a
|
|
5
|
+
scoped UI check or production smoke against a named URL and returns an
|
|
6
|
+
evidence record. Never edits source.
|
|
7
|
+
tools:
|
|
8
|
+
- Read
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Bash
|
|
12
|
+
readonly: true
|
|
13
|
+
modelTier: scoped
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Browser Operator
|
|
17
|
+
|
|
18
|
+
You operate a browser for one scoped check and report evidence. Read `browser.md` and `capability-is-not-authority.md` in `.cratis/ai/rules/` before the first browser call.
|
|
19
|
+
|
|
20
|
+
Browser tools are granted by the harness (for example an MCP server), not by this file. Frontmatter cannot grant them. If none are available, say so and stop.
|
|
21
|
+
|
|
22
|
+
## Before you start
|
|
23
|
+
|
|
24
|
+
- Confirm you were given the URL, scope, permit and artifact directory. If any is missing, return one specific question.
|
|
25
|
+
- Treat production as read-only. Do an action that changes production state only when the permit names that exact action.
|
|
26
|
+
- Prefer a staging or local copy for interactive and visual runs.
|
|
27
|
+
- Check for stale tabs and idle browsers first. Use one production tab.
|
|
28
|
+
|
|
29
|
+
## Allowed paths
|
|
30
|
+
|
|
31
|
+
- Write only under `.ai-work/<task>/browser/`, using Bash. Stage uploads there.
|
|
32
|
+
- Never edit repository files. Never copy secrets or tokens into artifacts.
|
|
33
|
+
- If a path guard blocks you, stop and report. Never monkey-patch DOM or file APIs to bypass it.
|
|
34
|
+
|
|
35
|
+
## Human handoff
|
|
36
|
+
|
|
37
|
+
On sign-in, 2FA or CAPTCHA, stop. Return `UI UNVERIFIED — needs human sign-in` and what a human must do. Do not guess credentials.
|
|
38
|
+
|
|
39
|
+
## Report
|
|
40
|
+
|
|
41
|
+
- URL, build or version, environment, timestamp
|
|
42
|
+
- Screenshot path under `.ai-work/`
|
|
43
|
+
- Correlation id
|
|
44
|
+
- What you checked, what you did not, and any blocker
|
|
@@ -10,10 +10,14 @@ tools:
|
|
|
10
10
|
- Glob
|
|
11
11
|
- Bash
|
|
12
12
|
readonly: true
|
|
13
|
+
modelTier: reviewer
|
|
14
|
+
reviewIndependence: different-provider
|
|
13
15
|
---
|
|
14
16
|
|
|
15
17
|
# Code Reviewer
|
|
16
18
|
|
|
19
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
20
|
+
|
|
17
21
|
## Scope before checklists
|
|
18
22
|
|
|
19
23
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -10,10 +10,14 @@ tools:
|
|
|
10
10
|
- Glob
|
|
11
11
|
- Bash
|
|
12
12
|
readonly: true
|
|
13
|
+
modelTier: reviewer
|
|
14
|
+
reviewIndependence: different-provider
|
|
13
15
|
---
|
|
14
16
|
|
|
15
17
|
# Performance Reviewer
|
|
16
18
|
|
|
19
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
20
|
+
|
|
17
21
|
## Scope before checklists
|
|
18
22
|
|
|
19
23
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -9,10 +9,14 @@ tools:
|
|
|
9
9
|
- Grep
|
|
10
10
|
- Glob
|
|
11
11
|
readonly: true
|
|
12
|
+
modelTier: reviewer
|
|
13
|
+
reviewIndependence: different-provider
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
# Repository Investigation Reviewer
|
|
15
17
|
|
|
18
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
19
|
+
|
|
16
20
|
You independently review a completed Cratis repository investigation. Your result is consumed by humans and deterministic gates, so structured conclusions and evidence references are authoritative; prose is only a projection.
|
|
17
21
|
|
|
18
22
|
## Authority and independence
|
|
@@ -12,10 +12,14 @@ tools:
|
|
|
12
12
|
- Glob
|
|
13
13
|
- Bash
|
|
14
14
|
readonly: true
|
|
15
|
+
modelTier: reviewer
|
|
16
|
+
reviewIndependence: different-provider
|
|
15
17
|
---
|
|
16
18
|
|
|
17
19
|
# Screenplay Reviewer
|
|
18
20
|
|
|
21
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
22
|
+
|
|
19
23
|
You are an independent reviewer of the `.play` model. You never write.
|
|
20
24
|
|
|
21
25
|
## Capability guard
|
|
@@ -11,10 +11,14 @@ tools:
|
|
|
11
11
|
- Glob
|
|
12
12
|
- Bash
|
|
13
13
|
readonly: true
|
|
14
|
+
modelTier: reviewer
|
|
15
|
+
reviewIndependence: different-provider
|
|
14
16
|
---
|
|
15
17
|
|
|
16
18
|
# Security Reviewer
|
|
17
19
|
|
|
20
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
21
|
+
|
|
18
22
|
## Scope before checklists
|
|
19
23
|
|
|
20
24
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*"
|
|
3
|
+
---
|
|
4
|
+
<!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
|
|
5
|
+
|
|
6
|
+
# Browser use
|
|
7
|
+
|
|
8
|
+
Browser access is a capability, not authority (see
|
|
9
|
+
[`capability-is-not-authority.md`](./capability-is-not-authority.instructions.md)). Every line is tagged
|
|
10
|
+
**[contract]** (binding) or **[convention]** (the house default) per the Three Levels of
|
|
11
|
+
Authority in [`general.md`](../../../rules/general.md). Read this before any browser call.
|
|
12
|
+
|
|
13
|
+
## Permit and handoff
|
|
14
|
+
|
|
15
|
+
- **[contract] Production is read-only.** Write to a production site only when the user's
|
|
16
|
+
request or an applicable policy names that exact action. A configured browser tool is not
|
|
17
|
+
a permit.
|
|
18
|
+
- **[contract] One production tab per session.** No parallel polling or parallel findings on
|
|
19
|
+
production. Run the health check first, close idle browsers, and look for stale tabs from
|
|
20
|
+
other sessions before opening one.
|
|
21
|
+
- **[convention] Prefer staging or a local copy** for interactive and visual smoke runs.
|
|
22
|
+
- **[contract] Only the `browser-operator` agent receives browser tools.** Hand it the URL,
|
|
23
|
+
scope, permit and artifact directory. The main session does not do browser work itself
|
|
24
|
+
unless no such agent is available. No other agent gets browser tools.
|
|
25
|
+
- **[contract] Stop for a human on sign-in, 2FA or CAPTCHA.** Record
|
|
26
|
+
`UI UNVERIFIED — needs human sign-in` and continue the other lanes. Do not block on it.
|
|
27
|
+
|
|
28
|
+
## Artifacts and uploads
|
|
29
|
+
|
|
30
|
+
- **[contract] Write artifacts and stage uploads only under `.ai-work/<task>/browser/`**
|
|
31
|
+
(see [`local-work-artifacts.md`](./local-work-artifacts.instructions.md)). If a path guard blocks you,
|
|
32
|
+
stop and report. Never monkey-patch DOM or file APIs to get around it.
|
|
33
|
+
- **[contract] No secrets or tokens in artifacts, URLs or logs.**
|
|
34
|
+
|
|
35
|
+
## Evidence
|
|
36
|
+
|
|
37
|
+
- **[contract] A UI verification records:** URL, build or version, screenshot path under
|
|
38
|
+
`.ai-work/`, correlation id, timestamp and environment. Without these it is unverified.
|
|
39
|
+
|
|
40
|
+
## Headless production-smoke checklist
|
|
41
|
+
|
|
42
|
+
- **[convention]** Port-forward to the service.
|
|
43
|
+
- **[convention]** Front it with a GET-only proxy that injects the required headers.
|
|
44
|
+
- **[convention]** Drive it from a fresh headless browser with no persistent profile.
|
|
45
|
+
- **[convention]** Give any signed-in profile a single owner.
|
|
46
|
+
- **[convention]** Tear down the browser, proxy and port-forward when done.
|
|
@@ -54,6 +54,9 @@ dumps, and similar coordination files. These are **work records, not documentati
|
|
|
54
54
|
worktree and branch behind, which is why the script exists. If the branch must outlive the
|
|
55
55
|
task unmerged, leave the worktree and say so in the handoff. Never `--force` a removal; a
|
|
56
56
|
refusal means look, not push harder.
|
|
57
|
+
- **Scan for secrets before archiving or sharing.** Before anything from `.ai-work/` is archived,
|
|
58
|
+
attached or shared, run `gitleaks detect --no-git --source <dir>` (or the repository's equivalent)
|
|
59
|
+
and redact every finding. See [`secrets.md`](./secrets.instructions.md).
|
|
57
60
|
- **A decision log is not a work record.** A decision — a durable choice with a
|
|
58
61
|
decider and a date — is documentation: it lives in **`decisions/`** (or the
|
|
59
62
|
repository's documented decisions folder, such as `.cratis/ai.json` `process.decisions.path`) and is reviewed like any other
|
|
@@ -66,3 +66,14 @@ scope limits when combining reports.
|
|
|
66
66
|
When a workflow requires a typed review envelope, preserve its schema and express
|
|
67
67
|
these sections, verdict meanings, and scope limits through its existing fields.
|
|
68
68
|
Do not append a competing Markdown report or invent envelope fields.
|
|
69
|
+
|
|
70
|
+
## Reviewer independence
|
|
71
|
+
|
|
72
|
+
- **[contract]** Run a reviewer on a different provider family than the author's model
|
|
73
|
+
where the harness can select one. The reviewer agents declare
|
|
74
|
+
`reviewIndependence: different-provider` and the `reviewer` model tier.
|
|
75
|
+
- **[contract]** Where the harness cannot select a provider, state `single-provider` in the
|
|
76
|
+
report header and on the Not examined line.
|
|
77
|
+
- **[contract]** A provider or tool error makes the review **Incomplete**. Fall back once
|
|
78
|
+
to the other family. Never report a failed verdict, or Approved, because the reviewer
|
|
79
|
+
could not run.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*"
|
|
3
|
+
---
|
|
4
|
+
<!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
|
|
5
|
+
|
|
6
|
+
# Secrets never enter agent transcripts
|
|
7
|
+
|
|
8
|
+
A transcript is saved, summarized and shared, so a credential that is printed once is leaked.
|
|
9
|
+
Every line is tagged **[contract]** (binding) per the Three Levels of Authority in
|
|
10
|
+
[`general.md`](../../../rules/general.md). The `cratis-guard-secrets` hook blocks the commands below
|
|
11
|
+
(see [`.cratis/ai/hooks/README.md`](../../../hooks/README.md)); the rule holds where no hook runs.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
- **[contract] Never run a command whose output contains credentials:** `kubectl get … -o json|yaml`
|
|
16
|
+
or `kubectl describe` on pods, deployments, statefulsets, daemonsets, jobs, configmaps or
|
|
17
|
+
secrets; `kubectl get secret`; `kubectl config view --raw`; `env`, `printenv`, `export -p`
|
|
18
|
+
(including `env | …`); `docker inspect`; `gh secret`, `gh api …/secrets`, `gh auth token`;
|
|
19
|
+
`vault read`, `vault kv get`; cloud secret-manager reads; `pulumi … --show-secrets`;
|
|
20
|
+
reading kubeconfigs, `.env*` files, private keys or token files.
|
|
21
|
+
- **[contract] Project the field you need and say which one:** `-o jsonpath='{.spec.containers[*].image}'`,
|
|
22
|
+
`-o custom-columns=…`, `kubectl get … -o name`, status fields, `kubectl logs`, `docker inspect --format`.
|
|
23
|
+
Read a `.env.example`, never the `.env`.
|
|
24
|
+
|
|
25
|
+
## Values
|
|
26
|
+
|
|
27
|
+
- **[contract] Never paste, echo or log a credential**, and never put one in a brief, handoff,
|
|
28
|
+
issue, PR, message or commit. Reference a secret by name only (secret/key, environment variable).
|
|
29
|
+
- **[contract] When a value appears in output, stop.** Do not copy it onward. Report
|
|
30
|
+
**SECURITY INCIDENT** with the file or tool-call location and the credential kind, and ask for
|
|
31
|
+
rotation. Do not retry the command in another form.
|
|
32
|
+
- **[contract] Redact before archiving.** Scan and redact a work record before it is archived or
|
|
33
|
+
shared (see [`local-work-artifacts.md`](./local-work-artifacts.instructions.md)).
|
|
34
|
+
- **[contract] The escape hatch is a human's.** `CRATIS_HOOKS_ALLOW_SECRET_READS=1` is set by the
|
|
35
|
+
person who authorized the read, in the harness environment, never by an agent.
|
|
@@ -6,6 +6,7 @@ description: >
|
|
|
6
6
|
commands, events, validators, constraints, read models, projections,
|
|
7
7
|
and reactors — all in strict compliance with the vertical slice architecture.
|
|
8
8
|
tools: read, grep, find, bash, edit, write
|
|
9
|
+
modelTier: scoped
|
|
9
10
|
---
|
|
10
11
|
<!-- cratis-ai: generated Pi adapter of agents/backend-developer.md. Do not edit; the canonical agent is the source. -->
|
|
11
12
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Browser Operator
|
|
3
|
+
description: >
|
|
4
|
+
Read-only browser agent. The only agent type given browser tools. Runs a
|
|
5
|
+
scoped UI check or production smoke against a named URL and returns an
|
|
6
|
+
evidence record. Never edits source.
|
|
7
|
+
tools: read, grep, find, bash
|
|
8
|
+
readonly: true
|
|
9
|
+
modelTier: scoped
|
|
10
|
+
---
|
|
11
|
+
<!-- cratis-ai: generated Pi adapter of agents/browser-operator.md. Do not edit; the canonical agent is the source. -->
|
|
12
|
+
|
|
13
|
+
# Browser Operator
|
|
14
|
+
|
|
15
|
+
You operate a browser for one scoped check and report evidence. Read `browser.md` and `capability-is-not-authority.md` in `.cratis/ai/rules/` before the first browser call.
|
|
16
|
+
|
|
17
|
+
Browser tools are granted by the harness (for example an MCP server), not by this file. Frontmatter cannot grant them. If none are available, say so and stop.
|
|
18
|
+
|
|
19
|
+
## Before you start
|
|
20
|
+
|
|
21
|
+
- Confirm you were given the URL, scope, permit and artifact directory. If any is missing, return one specific question.
|
|
22
|
+
- Treat production as read-only. Do an action that changes production state only when the permit names that exact action.
|
|
23
|
+
- Prefer a staging or local copy for interactive and visual runs.
|
|
24
|
+
- Check for stale tabs and idle browsers first. Use one production tab.
|
|
25
|
+
|
|
26
|
+
## Allowed paths
|
|
27
|
+
|
|
28
|
+
- Write only under `.ai-work/<task>/browser/`, using Bash. Stage uploads there.
|
|
29
|
+
- Never edit repository files. Never copy secrets or tokens into artifacts.
|
|
30
|
+
- If a path guard blocks you, stop and report. Never monkey-patch DOM or file APIs to bypass it.
|
|
31
|
+
|
|
32
|
+
## Human handoff
|
|
33
|
+
|
|
34
|
+
On sign-in, 2FA or CAPTCHA, stop. Return `UI UNVERIFIED — needs human sign-in` and what a human must do. Do not guess credentials.
|
|
35
|
+
|
|
36
|
+
## Report
|
|
37
|
+
|
|
38
|
+
- URL, build or version, environment, timestamp
|
|
39
|
+
- Screenshot path under `.ai-work/`
|
|
40
|
+
- Correlation id
|
|
41
|
+
- What you checked, what you did not, and any blocker
|
|
@@ -6,11 +6,15 @@ description: >
|
|
|
6
6
|
TypeScript conventions, and vertical slice correctness before merge.
|
|
7
7
|
tools: read, grep, find, bash
|
|
8
8
|
readonly: true
|
|
9
|
+
modelTier: reviewer
|
|
10
|
+
reviewIndependence: different-provider
|
|
9
11
|
---
|
|
10
12
|
<!-- cratis-ai: generated Pi adapter of agents/code-reviewer.md. Do not edit; the canonical agent is the source. -->
|
|
11
13
|
|
|
12
14
|
# Code Reviewer
|
|
13
15
|
|
|
16
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
17
|
+
|
|
14
18
|
## Scope before checklists
|
|
15
19
|
|
|
16
20
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -9,6 +9,7 @@ description: >
|
|
|
9
9
|
multiple slices, mixed C#/TypeScript work, or requires both implementation
|
|
10
10
|
and review).
|
|
11
11
|
tools: read, grep, find, bash
|
|
12
|
+
modelTier: scoped
|
|
12
13
|
---
|
|
13
14
|
<!-- cratis-ai: generated Pi adapter of agents/coordinator.md. Do not edit; the canonical agent is the source. -->
|
|
14
15
|
|
|
@@ -5,6 +5,7 @@ description: >
|
|
|
5
5
|
Implements React components that consume auto-generated command and query
|
|
6
6
|
proxies, following the project's component and styling conventions.
|
|
7
7
|
tools: read, grep, find, bash, edit, write
|
|
8
|
+
modelTier: scoped
|
|
8
9
|
---
|
|
9
10
|
<!-- cratis-ai: generated Pi adapter of agents/frontend-developer.md. Do not edit; the canonical agent is the source. -->
|
|
10
11
|
|
|
@@ -9,6 +9,7 @@ description: >
|
|
|
9
9
|
as a team: mixed implementation + documentation + review, multi-feature work,
|
|
10
10
|
large refactors, or any goal that spans more than one concern.
|
|
11
11
|
tools: read, grep, find, bash
|
|
12
|
+
modelTier: scoped
|
|
12
13
|
---
|
|
13
14
|
<!-- cratis-ai: generated Pi adapter of agents/orchestrator.md. Do not edit; the canonical agent is the source. -->
|
|
14
15
|
|
|
@@ -6,11 +6,15 @@ description: >
|
|
|
6
6
|
React render overhead, and Chronicle anti-patterns before merge.
|
|
7
7
|
tools: read, grep, find, bash
|
|
8
8
|
readonly: true
|
|
9
|
+
modelTier: reviewer
|
|
10
|
+
reviewIndependence: different-provider
|
|
9
11
|
---
|
|
10
12
|
<!-- cratis-ai: generated Pi adapter of agents/performance-reviewer.md. Do not edit; the canonical agent is the source. -->
|
|
11
13
|
|
|
12
14
|
# Performance Reviewer
|
|
13
15
|
|
|
16
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
17
|
+
|
|
14
18
|
## Scope before checklists
|
|
15
19
|
|
|
16
20
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -6,6 +6,7 @@ description: >
|
|
|
6
6
|
to the right specialist agent, and ensures quality gates are met before
|
|
7
7
|
the work is considered done.
|
|
8
8
|
tools: read, grep, find, bash
|
|
9
|
+
modelTier: scoped
|
|
9
10
|
---
|
|
10
11
|
<!-- cratis-ai: generated Pi adapter of agents/planner.md. Do not edit; the canonical agent is the source. -->
|
|
11
12
|
|
|
@@ -6,11 +6,15 @@ description: >
|
|
|
6
6
|
conventions to framework or client-library repositories.
|
|
7
7
|
tools: read, grep, find
|
|
8
8
|
readonly: true
|
|
9
|
+
modelTier: reviewer
|
|
10
|
+
reviewIndependence: different-provider
|
|
9
11
|
---
|
|
10
12
|
<!-- cratis-ai: generated Pi adapter of agents/repository-investigation-reviewer.md. Do not edit; the canonical agent is the source. -->
|
|
11
13
|
|
|
12
14
|
# Repository Investigation Reviewer
|
|
13
15
|
|
|
16
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
17
|
+
|
|
14
18
|
You independently review a completed Cratis repository investigation. Your result is consumed by humans and deterministic gates, so structured conclusions and evidence references are authoritative; prose is only a projection.
|
|
15
19
|
|
|
16
20
|
## Authority and independence
|
|
@@ -6,6 +6,7 @@ description: >
|
|
|
6
6
|
mutating Chronicle operations, or assuming an application architecture.
|
|
7
7
|
tools: read, grep, find, bash
|
|
8
8
|
readonly: true
|
|
9
|
+
modelTier: scoped
|
|
9
10
|
---
|
|
10
11
|
<!-- cratis-ai: generated Pi adapter of agents/repository-investigator.md. Do not edit; the canonical agent is the source. -->
|
|
11
12
|
|
|
@@ -8,6 +8,7 @@ description: >
|
|
|
8
8
|
legacy extraction. Does not write application code.
|
|
9
9
|
tools: read, grep, find, bash, edit, write
|
|
10
10
|
readonly: false
|
|
11
|
+
modelTier: scoped
|
|
11
12
|
---
|
|
12
13
|
<!-- cratis-ai: generated Pi adapter of agents/screenplay-modeler.md. Do not edit; the canonical agent is the source. -->
|
|
13
14
|
|
|
@@ -8,6 +8,7 @@ description: >
|
|
|
8
8
|
Stage-managed files; routes non-renderable scope to slice-implementer.
|
|
9
9
|
tools: read, grep, find, bash
|
|
10
10
|
readonly: false
|
|
11
|
+
modelTier: scoped
|
|
11
12
|
---
|
|
12
13
|
<!-- cratis-ai: generated Pi adapter of agents/screenplay-renderer.md. Do not edit; the canonical agent is the source. -->
|
|
13
14
|
|
|
@@ -8,11 +8,15 @@ description: >
|
|
|
8
8
|
Returns defects separately from business questions and cannot edit files.
|
|
9
9
|
tools: read, grep, find, bash
|
|
10
10
|
readonly: true
|
|
11
|
+
modelTier: reviewer
|
|
12
|
+
reviewIndependence: different-provider
|
|
11
13
|
---
|
|
12
14
|
<!-- cratis-ai: generated Pi adapter of agents/screenplay-reviewer.md. Do not edit; the canonical agent is the source. -->
|
|
13
15
|
|
|
14
16
|
# Screenplay Reviewer
|
|
15
17
|
|
|
18
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
19
|
+
|
|
16
20
|
You are an independent reviewer of the `.play` model. You never write.
|
|
17
21
|
|
|
18
22
|
## Capability guard
|
|
@@ -7,11 +7,15 @@ description: >
|
|
|
7
7
|
attack surface.
|
|
8
8
|
tools: read, grep, find, bash
|
|
9
9
|
readonly: true
|
|
10
|
+
modelTier: reviewer
|
|
11
|
+
reviewIndependence: different-provider
|
|
10
12
|
---
|
|
11
13
|
<!-- cratis-ai: generated Pi adapter of agents/security-reviewer.md. Do not edit; the canonical agent is the source. -->
|
|
12
14
|
|
|
13
15
|
# Security Reviewer
|
|
14
16
|
|
|
17
|
+
Run on a different provider than the author where the harness can select one; see "Reviewer independence" in `review-reports.md`.
|
|
18
|
+
|
|
15
19
|
## Scope before checklists
|
|
16
20
|
|
|
17
21
|
Identify the repository profile and changed lane before selecting rules or running a checklist. Read the repository's `AGENTS.md` and applicable universal rules in `.cratis/ai/rules/`. For framework contributions, load `.cratis/ai/rules/framework.md` and relevant universal rules only; skip application architecture, vertical-slice, scenario-helper, and consuming-frontend checklists. Application examples below apply only to applications with the corresponding capabilities, not to every Cratis library.
|
|
@@ -5,6 +5,7 @@ description: >
|
|
|
5
5
|
in when_*/ folders, and the React surface (page and/or command dialog). Use for new slices and for
|
|
6
6
|
non-trivial slice changes spanning backend and frontend.
|
|
7
7
|
tools: read, grep, find, bash, edit, write
|
|
8
|
+
modelTier: scoped
|
|
8
9
|
---
|
|
9
10
|
<!-- cratis-ai: generated Pi adapter of agents/slice-implementer.md. Do not edit; the canonical agent is the source. -->
|
|
10
11
|
|
|
@@ -5,6 +5,7 @@ description: >
|
|
|
5
5
|
TypeScript/React specs for vertical slices. Ensures every slice has
|
|
6
6
|
comprehensive behavior coverage following the project's BDD conventions.
|
|
7
7
|
tools: read, grep, find, bash, edit, write
|
|
8
|
+
modelTier: scoped
|
|
8
9
|
---
|
|
9
10
|
<!-- cratis-ai: generated Pi adapter of agents/spec-writer.md. Do not edit; the canonical agent is the source. -->
|
|
10
11
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Claude PreToolUse (Write|Edit) → Pi `tool_call` → cratis-guard-writes.sh (exit 2 = block)
|
|
10
10
|
* Claude PreToolUse (Bash) → Pi `tool_call` → cratis-guard-store-mutations.sh (exit 2 = block)
|
|
11
|
+
* Claude PreToolUse (Bash) → Pi `tool_call` → cratis-guard-secrets.sh (exit 2 = block)
|
|
11
12
|
* Claude PreToolUse (Bash) → Pi `tool_call` → cratis-guard-pr-body.sh (exit 2 = block)
|
|
12
13
|
* Claude PostToolUse (Write|Edit) → Pi `tool_result` → cratis-pattern-scan.sh (advisory context)
|
|
13
14
|
* Claude PostToolUse (Bash) → Pi `tool_result` → cratis-cleanup-worktrees.sh --hook (removes delivered worktrees/branches)
|
|
@@ -26,11 +27,11 @@
|
|
|
26
27
|
*
|
|
27
28
|
* Nothing here duplicates corpus content: it is adapter machinery, the Pi peer of the Claude
|
|
28
29
|
* `hooks` block in `.claude/settings.json`. Every environment escape hatch the scripts honor
|
|
29
|
-
* (CRATIS_HOOKS_ALLOW_PROTECTED_WRITES, CRATIS_HOOKS_ALLOW_STORE_MUTATIONS, CRATIS_HOOKS_SKIP_SCAN,
|
|
30
|
+
* (CRATIS_HOOKS_ALLOW_PROTECTED_WRITES, CRATIS_HOOKS_ALLOW_STORE_MUTATIONS, CRATIS_HOOKS_ALLOW_SECRET_READS, CRATIS_HOOKS_SKIP_SCAN,
|
|
30
31
|
* CRATIS_HOOKS_SKIP_GATE, …) still works because the scripts are executed unchanged, in the environment
|
|
31
32
|
* Pi was started from.
|
|
32
33
|
*
|
|
33
|
-
* Only Pi's `bash` tool is bridged to the store-mutation
|
|
34
|
+
* Only Pi's `bash` tool is bridged to the store-mutation and secrets guards. A command the user types directly (`!cmd`,
|
|
34
35
|
* the `user_bash` event) is the person's own action and is deliberately not guarded.
|
|
35
36
|
*/
|
|
36
37
|
|
|
@@ -161,6 +162,19 @@ async function runBlockingGuard(
|
|
|
161
162
|
return undefined;
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
/** Runs the installed blocking Bash guards in order; the first refusal wins. */
|
|
166
|
+
async function runCommandGuards(
|
|
167
|
+
guards: Array<[script: string, name: string]>,
|
|
168
|
+
payload: object,
|
|
169
|
+
ctx: ToolCallContext,
|
|
170
|
+
): Promise<{ block: true; reason: string } | undefined> {
|
|
171
|
+
for (const [script, name] of guards.filter(([guard]) => isInstalled(guard))) {
|
|
172
|
+
const blocked = await runBlockingGuard(script, name, "command", payload, ctx);
|
|
173
|
+
if (blocked) return blocked;
|
|
174
|
+
}
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
|
|
164
178
|
/**
|
|
165
179
|
* Whether a hook script is installed at all.
|
|
166
180
|
*
|
|
@@ -186,6 +200,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
186
200
|
const scriptsDir = fs.existsSync(managedScriptsDir) ? managedScriptsDir : path.join(bundledCorpusRoot, "hooks", "scripts");
|
|
187
201
|
const guardWrites = path.join(scriptsDir, "cratis-guard-writes.sh");
|
|
188
202
|
const guardStoreMutations = path.join(scriptsDir, "cratis-guard-store-mutations.sh");
|
|
203
|
+
const guardSecrets = path.join(scriptsDir, "cratis-guard-secrets.sh");
|
|
189
204
|
const guardPrBody = path.join(scriptsDir, "cratis-guard-pr-body.sh");
|
|
190
205
|
const patternScan = path.join(scriptsDir, "cratis-pattern-scan.sh");
|
|
191
206
|
const qualityGate = path.join(scriptsDir, "cratis-quality-gate.sh");
|
|
@@ -214,10 +229,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
214
229
|
const command = (event as any).input?.command;
|
|
215
230
|
if (typeof command !== "string" || !command.trim()) return;
|
|
216
231
|
const payload = { cwd: ctx.cwd, tool_name: "Bash", tool_input: { command } };
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (blocked) return blocked;
|
|
220
|
-
}
|
|
232
|
+
const blocked = await runCommandGuards([[guardStoreMutations, "cratis-guard-store-mutations"], [guardSecrets, "cratis-guard-secrets"]], payload, ctx);
|
|
233
|
+
if (blocked) return blocked;
|
|
221
234
|
if (isInstalled(guardPrBody)) {
|
|
222
235
|
const run = await runScript(guardPrBody, JSON.stringify(payload), ctx.cwd, ctx.signal);
|
|
223
236
|
if (run.failed || run.code !== 0) return { block: true, reason: run.stderr.trim() || "cratis-guard-pr-body could not check this command." };
|
|
@@ -285,6 +285,15 @@ export function tailLines(file: string, lines: number): string {
|
|
|
285
285
|
|
|
286
286
|
export type Fingerprint = { kind: "ok"; value: string; root: string } | { kind: "not-repository" } | { kind: "unknown"; reason?: string };
|
|
287
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Git's discovery failure, in both wordings: "(or any of the parent directories)" and, when discovery stops at a
|
|
290
|
+
* filesystem boundary, "(or any parent up to mount point /tmp)". A broken GIT_DIR ("not a git repository: '<path>'")
|
|
291
|
+
* is not a non-repository, so it stays unknown.
|
|
292
|
+
*/
|
|
293
|
+
export function isNotRepositoryError(stderr: string): boolean {
|
|
294
|
+
return stderr.includes("not a git repository (or any ");
|
|
295
|
+
}
|
|
296
|
+
|
|
288
297
|
/** Digest the working tree; a Git failure or deadline is unknown, never proof that no gate applies. */
|
|
289
298
|
export async function workingTreeFingerprint(cwd: string, timeoutMs = FINGERPRINT_TIMEOUT_MS, signal?: AbortSignal): Promise<Fingerprint> {
|
|
290
299
|
const hash = createHash("sha256");
|
|
@@ -297,7 +306,7 @@ export async function workingTreeFingerprint(cwd: string, timeoutMs = FINGERPRIN
|
|
|
297
306
|
};
|
|
298
307
|
const root = await git(["rev-parse", "--show-toplevel"]);
|
|
299
308
|
if (!root || root.aborted || root.timedOut || root.failed) return { kind: "unknown" };
|
|
300
|
-
if (root.code !== 0) return root.stderr
|
|
309
|
+
if (root.code !== 0) return isNotRepositoryError(root.stderr) ? { kind: "not-repository" } : { kind: "unknown" };
|
|
301
310
|
const status = await git(["status", "--porcelain=v2", "-z", "--untracked-files=all", "--ignore-submodules=none"]);
|
|
302
311
|
if (!status || status.code !== 0 || status.aborted || status.timedOut || status.failed || status.stdoutTruncated) return { kind: "unknown" };
|
|
303
312
|
const head = await git(["rev-parse", "--verify", "-q", "HEAD"]);
|