@spences10/pi-harness 0.0.2
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/LICENSE +21 -0
- package/README.md +118 -0
- package/dist/enforcement/policy.d.ts +13 -0
- package/dist/enforcement/policy.js +85 -0
- package/dist/enforcement/policy.js.map +1 -0
- package/dist/extension.d.ts +3 -0
- package/dist/extension.js +180 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.js +4 -0
- package/dist/prompt.js.map +1 -0
- package/dist/runtime/files.d.ts +22 -0
- package/dist/runtime/files.js +46 -0
- package/dist/runtime/files.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +154 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/outcome.d.ts +5 -0
- package/dist/runtime/outcome.js +138 -0
- package/dist/runtime/outcome.js.map +1 -0
- package/dist/runtime/renderers.d.ts +7 -0
- package/dist/runtime/renderers.js +236 -0
- package/dist/runtime/renderers.js.map +1 -0
- package/dist/schema.d.ts +105 -0
- package/dist/schema.js +62 -0
- package/dist/schema.js.map +1 -0
- package/package.json +71 -0
- package/skills/create-harness/SKILL.md +54 -0
- package/skills/execute-harness/SKILL.md +55 -0
- package/skills/review-harness/SKILL.md +55 -0
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Type, type Static } from 'typebox';
|
|
2
|
+
export declare const HARNESS_VERSION = 1;
|
|
3
|
+
export declare const HARNESS_CUSTOM_TYPE = "pi-harness-state";
|
|
4
|
+
export declare const DEFAULT_FORBIDDEN_COMMANDS: string[];
|
|
5
|
+
export declare const thinking_levels_schema: Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>;
|
|
6
|
+
export declare const harness_create_params_schema: Type.TObject<{
|
|
7
|
+
task: Type.TString;
|
|
8
|
+
slug: Type.TOptional<Type.TString>;
|
|
9
|
+
cwd: Type.TOptional<Type.TString>;
|
|
10
|
+
allowed_paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
11
|
+
forbidden_paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
12
|
+
validation_commands: Type.TOptional<Type.TArray<Type.TString>>;
|
|
13
|
+
forbidden_commands: Type.TOptional<Type.TArray<Type.TString>>;
|
|
14
|
+
allow_test_changes: Type.TOptional<Type.TBoolean>;
|
|
15
|
+
planner_model: Type.TOptional<Type.TString>;
|
|
16
|
+
planner_thinking: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>>;
|
|
17
|
+
executor_model: Type.TOptional<Type.TString>;
|
|
18
|
+
executor_thinking: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>>;
|
|
19
|
+
reviewer_model: Type.TOptional<Type.TString>;
|
|
20
|
+
reviewer_thinking: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>>;
|
|
21
|
+
}>;
|
|
22
|
+
export type HarnessCreateParams = Static<typeof harness_create_params_schema>;
|
|
23
|
+
export declare const harness_update_params_schema: Type.TObject<{
|
|
24
|
+
harness_dir: Type.TString;
|
|
25
|
+
status: Type.TOptional<Type.TUnion<[Type.TLiteral<"created">, Type.TLiteral<"running">, Type.TLiteral<"reviewing">, Type.TLiteral<"completed">, Type.TLiteral<"failed">]>>;
|
|
26
|
+
phase: Type.TOptional<Type.TString>;
|
|
27
|
+
note: Type.TOptional<Type.TString>;
|
|
28
|
+
evidence: Type.TOptional<Type.TString>;
|
|
29
|
+
team_status: Type.TOptional<Type.TString>;
|
|
30
|
+
remaining_risks: Type.TOptional<Type.TArray<Type.TString>>;
|
|
31
|
+
changed_files: Type.TOptional<Type.TArray<Type.TString>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type HarnessUpdateParams = Static<typeof harness_update_params_schema>;
|
|
34
|
+
export declare const harness_read_params_schema: Type.TObject<{
|
|
35
|
+
harness_dir: Type.TString;
|
|
36
|
+
}>;
|
|
37
|
+
export type HarnessReadParams = Static<typeof harness_read_params_schema>;
|
|
38
|
+
export type HarnessStatus = 'created' | 'running' | 'reviewing' | 'completed' | 'failed';
|
|
39
|
+
export type HarnessThinking = Static<typeof thinking_levels_schema>;
|
|
40
|
+
export interface HarnessContract {
|
|
41
|
+
version: typeof HARNESS_VERSION;
|
|
42
|
+
id: string;
|
|
43
|
+
task: string;
|
|
44
|
+
cwd: string;
|
|
45
|
+
created_at: string;
|
|
46
|
+
status: HarnessStatus;
|
|
47
|
+
planner: {
|
|
48
|
+
model?: string;
|
|
49
|
+
thinking?: HarnessThinking;
|
|
50
|
+
};
|
|
51
|
+
executor: {
|
|
52
|
+
model?: string;
|
|
53
|
+
thinking?: HarnessThinking;
|
|
54
|
+
};
|
|
55
|
+
reviewer: {
|
|
56
|
+
model?: string;
|
|
57
|
+
thinking?: HarnessThinking;
|
|
58
|
+
};
|
|
59
|
+
allowed_paths: string[];
|
|
60
|
+
forbidden_paths: string[];
|
|
61
|
+
allowed_tools: string[];
|
|
62
|
+
validation_commands: string[];
|
|
63
|
+
forbidden_commands: string[];
|
|
64
|
+
allow_test_changes: boolean;
|
|
65
|
+
escalation_rules: string[];
|
|
66
|
+
baseline_changed_files: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface HarnessLogEntry {
|
|
69
|
+
timestamp: string;
|
|
70
|
+
status?: HarnessStatus;
|
|
71
|
+
phase?: string;
|
|
72
|
+
note?: string;
|
|
73
|
+
evidence?: string;
|
|
74
|
+
team_status?: string;
|
|
75
|
+
remaining_risks?: string[];
|
|
76
|
+
changed_files?: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface HarnessOutcome {
|
|
79
|
+
id: string;
|
|
80
|
+
status: HarnessStatus;
|
|
81
|
+
phase?: string;
|
|
82
|
+
task: string;
|
|
83
|
+
cwd: string;
|
|
84
|
+
generated_at: string;
|
|
85
|
+
execution_cwd: string;
|
|
86
|
+
changed_files: string[];
|
|
87
|
+
baseline_changed_files: string[];
|
|
88
|
+
validation: {
|
|
89
|
+
commands: string[];
|
|
90
|
+
evidence: Array<{
|
|
91
|
+
timestamp: string;
|
|
92
|
+
phase?: string;
|
|
93
|
+
evidence: string;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
team_status: string;
|
|
97
|
+
remaining_risks: string[];
|
|
98
|
+
log: HarnessLogEntry[];
|
|
99
|
+
}
|
|
100
|
+
export interface HarnessStatusFile {
|
|
101
|
+
id: string;
|
|
102
|
+
status: HarnessStatus;
|
|
103
|
+
phase?: string;
|
|
104
|
+
log: HarnessLogEntry[];
|
|
105
|
+
}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Type } from 'typebox';
|
|
2
|
+
export const HARNESS_VERSION = 1;
|
|
3
|
+
export const HARNESS_CUSTOM_TYPE = 'pi-harness-state';
|
|
4
|
+
export const DEFAULT_FORBIDDEN_COMMANDS = [
|
|
5
|
+
'rm -rf .git',
|
|
6
|
+
'git reset --hard',
|
|
7
|
+
'git clean -fd',
|
|
8
|
+
'--updateSnapshot',
|
|
9
|
+
' -u ',
|
|
10
|
+
];
|
|
11
|
+
export const thinking_levels_schema = Type.Union([
|
|
12
|
+
Type.Literal('off'),
|
|
13
|
+
Type.Literal('minimal'),
|
|
14
|
+
Type.Literal('low'),
|
|
15
|
+
Type.Literal('medium'),
|
|
16
|
+
Type.Literal('high'),
|
|
17
|
+
Type.Literal('xhigh'),
|
|
18
|
+
]);
|
|
19
|
+
export const harness_create_params_schema = Type.Object({
|
|
20
|
+
task: Type.String({ description: 'Task the harness is built for' }),
|
|
21
|
+
slug: Type.Optional(Type.String({ description: 'Descriptive filesystem-safe name' })),
|
|
22
|
+
cwd: Type.Optional(Type.String({ description: 'Project working directory' })),
|
|
23
|
+
allowed_paths: Type.Optional(Type.Array(Type.String({
|
|
24
|
+
description: 'Path or glob-like path the executor may edit, relative to cwd unless absolute',
|
|
25
|
+
}))),
|
|
26
|
+
forbidden_paths: Type.Optional(Type.Array(Type.String({ description: 'Path the executor may not edit' }))),
|
|
27
|
+
validation_commands: Type.Optional(Type.Array(Type.String({ description: 'Command run from cwd' }))),
|
|
28
|
+
forbidden_commands: Type.Optional(Type.Array(Type.String({ description: 'Command substring to block' }))),
|
|
29
|
+
allow_test_changes: Type.Optional(Type.Boolean({
|
|
30
|
+
description: 'Whether executor may edit test files',
|
|
31
|
+
})),
|
|
32
|
+
planner_model: Type.Optional(Type.String()),
|
|
33
|
+
planner_thinking: Type.Optional(thinking_levels_schema),
|
|
34
|
+
executor_model: Type.Optional(Type.String()),
|
|
35
|
+
executor_thinking: Type.Optional(thinking_levels_schema),
|
|
36
|
+
reviewer_model: Type.Optional(Type.String()),
|
|
37
|
+
reviewer_thinking: Type.Optional(thinking_levels_schema),
|
|
38
|
+
});
|
|
39
|
+
export const harness_update_params_schema = Type.Object({
|
|
40
|
+
harness_dir: Type.String({
|
|
41
|
+
description: 'Harness directory in /tmp',
|
|
42
|
+
}),
|
|
43
|
+
status: Type.Optional(Type.Union([
|
|
44
|
+
Type.Literal('created'),
|
|
45
|
+
Type.Literal('running'),
|
|
46
|
+
Type.Literal('reviewing'),
|
|
47
|
+
Type.Literal('completed'),
|
|
48
|
+
Type.Literal('failed'),
|
|
49
|
+
])),
|
|
50
|
+
phase: Type.Optional(Type.String()),
|
|
51
|
+
note: Type.Optional(Type.String()),
|
|
52
|
+
evidence: Type.Optional(Type.String()),
|
|
53
|
+
team_status: Type.Optional(Type.String()),
|
|
54
|
+
remaining_risks: Type.Optional(Type.Array(Type.String())),
|
|
55
|
+
changed_files: Type.Optional(Type.Array(Type.String())),
|
|
56
|
+
});
|
|
57
|
+
export const harness_read_params_schema = Type.Object({
|
|
58
|
+
harness_dir: Type.String({
|
|
59
|
+
description: 'Harness directory in /tmp',
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,aAAa;IACb,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,MAAM;CACN,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC;IAChD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IACnB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IACnB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACnE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EA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": "Ephemeral task harness runtime for my-pi agent workflows",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"coding",
|
|
8
|
+
"harness",
|
|
9
|
+
"pi",
|
|
10
|
+
"pi-package",
|
|
11
|
+
"skills"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/spences10/my-pi/tree/main/packages/pi-harness#readme",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Scott Spence <me@scottspence.com>",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/spences10/my-pi.git",
|
|
19
|
+
"directory": "packages/pi-harness"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"skills",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@earendil-works/pi-coding-agent": "0.80.2",
|
|
40
|
+
"@types/node": "^25.8.0",
|
|
41
|
+
"typebox": "^1.1.38",
|
|
42
|
+
"typescript": "^6.0.3",
|
|
43
|
+
"vitest": "4.1.9"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
47
|
+
"typebox": "*"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=24.15.0"
|
|
51
|
+
},
|
|
52
|
+
"pi": {
|
|
53
|
+
"extensions": [
|
|
54
|
+
"./dist/index.js"
|
|
55
|
+
],
|
|
56
|
+
"skills": [
|
|
57
|
+
"./skills"
|
|
58
|
+
],
|
|
59
|
+
"image": "https://raw.githubusercontent.com/spences10/my-pi/main/assets/pi-package-preview.png"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run build:self",
|
|
63
|
+
"build:self": "vp exec tsc -p tsconfig.build.json",
|
|
64
|
+
"check": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run check:self",
|
|
65
|
+
"check:self": "vp exec tsc --noEmit -p tsconfig.json",
|
|
66
|
+
"test": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run test:self",
|
|
67
|
+
"test:self": "vp exec vitest run",
|
|
68
|
+
"coverage:self": "vp exec vitest run --coverage",
|
|
69
|
+
"coverage": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run coverage:self"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-harness
|
|
3
|
+
# prettier-ignore
|
|
4
|
+
description: Use when creating executable /tmp Pi task harnesses for ambiguous or high-risk coding work. Builds contract, prompts, validation, logs, and enforcement rules.
|
|
5
|
+
compatibility:
|
|
6
|
+
Requires my-pi or Pi with the pi-harness extension tools enabled.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Create Harness
|
|
10
|
+
|
|
11
|
+
Create a real my-pi task harness, not a prose-only plan. The harness
|
|
12
|
+
must live in `/tmp` and be created with the `harness_create` tool
|
|
13
|
+
after context gathering.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. Recover context with read-only tools first: docs, package READMEs,
|
|
18
|
+
source, tests, git, LSP, recall, browser, or MCP as relevant.
|
|
19
|
+
2. Establish source of truth: list the concrete files, commands, docs,
|
|
20
|
+
or evidence the harness is grounded in.
|
|
21
|
+
3. Challenge assumptions: identify uncertainties and whether the
|
|
22
|
+
executor may decide or must escalate.
|
|
23
|
+
4. Define the execution contract: allowed paths, forbidden paths,
|
|
24
|
+
validation commands, test-change policy, and forbidden shortcuts.
|
|
25
|
+
5. Call `harness_create` with the task and contract fields.
|
|
26
|
+
6. If the `team` tool is available, create or reuse a team and call
|
|
27
|
+
`task_create` with the harness directory in the description.
|
|
28
|
+
7. Read back the created harness path and report how to run it with
|
|
29
|
+
`/harness run <dir>`.
|
|
30
|
+
|
|
31
|
+
## Contract Guidance
|
|
32
|
+
|
|
33
|
+
- Keep `allowed_paths` narrow. Use `.` only when the task genuinely
|
|
34
|
+
spans the repo.
|
|
35
|
+
- Set `allow_test_changes: false` unless changing tests is explicitly
|
|
36
|
+
part of the task.
|
|
37
|
+
- Include validation commands whenever the project has a known check
|
|
38
|
+
path.
|
|
39
|
+
- Add `forbidden_commands` for task-specific hazards.
|
|
40
|
+
- Do not implement the task during harness creation unless the user
|
|
41
|
+
explicitly asks for combined create/run.
|
|
42
|
+
- Do not spawn a teammate during creation; save spawning for the run
|
|
43
|
+
phase.
|
|
44
|
+
|
|
45
|
+
## Output
|
|
46
|
+
|
|
47
|
+
Report only:
|
|
48
|
+
|
|
49
|
+
- harness directory
|
|
50
|
+
- source-of-truth inputs used
|
|
51
|
+
- allowed scope
|
|
52
|
+
- validation commands
|
|
53
|
+
- team task id if one was created
|
|
54
|
+
- open decisions or escalation triggers
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execute-harness
|
|
3
|
+
# prettier-ignore
|
|
4
|
+
description: Use when running an existing /tmp Pi task harness. Executes inside the active contract, records status, respects enforcement, and loops through validation.
|
|
5
|
+
compatibility:
|
|
6
|
+
Requires my-pi or Pi with the pi-harness extension tools enabled.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Execute Harness
|
|
10
|
+
|
|
11
|
+
Run the task through an existing my-pi harness. The harness is the
|
|
12
|
+
execution contract.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Resolve the harness directory from the user request or active
|
|
17
|
+
harness context.
|
|
18
|
+
2. Read `harness.json`, `SYSTEM.md`, `TASK.md`, and `status.json`
|
|
19
|
+
before editing.
|
|
20
|
+
3. Call `harness_update` with `status: running` and the current phase.
|
|
21
|
+
4. If the `team` tool is available and you are the team lead, create
|
|
22
|
+
or reuse a team, create/claim a task for the harness, and use
|
|
23
|
+
`member_spawn` with `workspace_mode: worktree` and `mutating: true`
|
|
24
|
+
to run one executor teammate against the harness.
|
|
25
|
+
5. The teammate prompt must tell it to read `harness.json`,
|
|
26
|
+
`SYSTEM.md`, `TASK.md`, and `status.json`, execute only inside the
|
|
27
|
+
contract, run `validate.sh` and `review.sh`, update harness
|
|
28
|
+
evidence, and report changed files plus risks.
|
|
29
|
+
6. Recover any remaining source-of-truth context needed to act safely.
|
|
30
|
+
7. Execute surgically inside `allowed_paths`; do not fight
|
|
31
|
+
enforcement.
|
|
32
|
+
8. Record decisions, phase changes, and validation evidence with
|
|
33
|
+
`harness_update`, including team status and remaining risks when
|
|
34
|
+
known.
|
|
35
|
+
9. Run `<harness_dir>/validate.sh`.
|
|
36
|
+
10. Run `<harness_dir>/review.sh` from the execution workspace. If
|
|
37
|
+
using a linked worktree, run it from that worktree or set
|
|
38
|
+
`HARNESS_CWD` to the worktree path.
|
|
39
|
+
11. Review `<harness_dir>/OUTCOME.md` or `<harness_dir>/outcome.json`
|
|
40
|
+
for changed files, baseline ignored files, validation evidence,
|
|
41
|
+
team status, and risks.
|
|
42
|
+
12. Mark `completed` only when validation passes and no escalation
|
|
43
|
+
rule applies; otherwise mark `failed` with evidence.
|
|
44
|
+
|
|
45
|
+
## Rules
|
|
46
|
+
|
|
47
|
+
- Do not edit outside the harness contract.
|
|
48
|
+
- Do not weaken tests, fake outputs, or bypass validation.
|
|
49
|
+
- If enforcement blocks an action, update the harness as failed or ask
|
|
50
|
+
for a planner/user amendment.
|
|
51
|
+
- If validation fails after one focused fix attempt, escalate.
|
|
52
|
+
- If team mode is unavailable, run the harness directly in the current
|
|
53
|
+
session and say that no teammate was spawned.
|
|
54
|
+
- Keep the final report to changed files, validation evidence, team
|
|
55
|
+
status/results, and remaining risks.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-harness
|
|
3
|
+
# prettier-ignore
|
|
4
|
+
description: Use when reviewing implementation work that ran through a /tmp Pi task harness. Checks contract drift, unsafe shortcuts, validation evidence, and status honesty.
|
|
5
|
+
compatibility:
|
|
6
|
+
Requires my-pi or Pi with the pi-harness extension tools enabled.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Review Harness
|
|
10
|
+
|
|
11
|
+
Review the completed or failed work against the harness contract.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. Resolve the harness directory and read `harness.json`, `TASK.md`,
|
|
16
|
+
`status.json`, `OUTCOME.md` or `outcome.json`, and
|
|
17
|
+
`logs/events.jsonl` if present.
|
|
18
|
+
2. Run or inspect `<harness_dir>/review.sh`.
|
|
19
|
+
3. Inspect git diff and changed files.
|
|
20
|
+
4. Compare changes against `allowed_paths`, `forbidden_paths`,
|
|
21
|
+
test-change policy, and escalation rules.
|
|
22
|
+
5. Verify validation evidence from `status.json`, logs, and command
|
|
23
|
+
output.
|
|
24
|
+
6. Decide: pass, needs executor fix, or escalate to planner/user.
|
|
25
|
+
|
|
26
|
+
## Review Checks
|
|
27
|
+
|
|
28
|
+
- Did work stay inside allowed paths?
|
|
29
|
+
- Were tests changed when `allow_test_changes` is false?
|
|
30
|
+
- Were validators weakened, deleted, skipped, or bypassed?
|
|
31
|
+
- Were outputs faked or hardcoded to satisfy checks?
|
|
32
|
+
- Are status and evidence entries honest and complete?
|
|
33
|
+
- Does the outcome artifact include changed files, validation
|
|
34
|
+
evidence, team status, and remaining risks?
|
|
35
|
+
- Did the executor make unapproved architecture decisions?
|
|
36
|
+
|
|
37
|
+
## Output Shape
|
|
38
|
+
|
|
39
|
+
```md
|
|
40
|
+
## Verdict
|
|
41
|
+
|
|
42
|
+
Pass | Needs executor fix | Escalate
|
|
43
|
+
|
|
44
|
+
## Findings
|
|
45
|
+
|
|
46
|
+
- P0/P1/P2: <issue> — `<path>` — <required action>
|
|
47
|
+
|
|
48
|
+
## Validation Evidence
|
|
49
|
+
|
|
50
|
+
- `<command>` — pass/fail/not run — <evidence>
|
|
51
|
+
|
|
52
|
+
## Required Next Step
|
|
53
|
+
|
|
54
|
+
- <one action>
|
|
55
|
+
```
|