@cratis/pi 7.145.0 → 7.147.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/planner.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +1 -1
- package/package/corpus/harnesses/pi/agents/planner.md +1 -1
- package/package/corpus/hooks/README.md +21 -0
- package/package/corpus/hooks/scripts/cratis-check-handoff.mjs +286 -0
- package/package/corpus/rules/profiles.md +1 -1
- package/package/corpus/skills/cratis-orchestration-lanes/SKILL.md +4 -4
- package/package/corpus/skills/cratis-orchestration-lanes/verification.json +1 -1
- package/package/corpus/skills/cratis-session-handoff/LICENSE +2 -0
- package/package/corpus/skills/cratis-session-handoff/SKILL.md +109 -0
- package/package/corpus/skills/cratis-session-handoff/references/handoff-template.md +135 -0
- package/package/corpus/skills/cratis-session-handoff/verification.json +15 -0
- package/package/profile-catalog.json +1 -0
- package/package.json +1 -1
- package/package/corpus/skills/cratis-orchestration-lanes/references/context-handoff.md +0 -85
|
@@ -148,7 +148,7 @@ For an implemented application slice, require the applicable changed-lane gates
|
|
|
148
148
|
|
|
149
149
|
For large features with many slices, use these techniques to keep context manageable:
|
|
150
150
|
|
|
151
|
-
-
|
|
151
|
+
- Keep a state note and hand off between phases: follow `cratis-session-handoff`.
|
|
152
152
|
- **`/fork`** before exploring an alternative design approach, so the original plan is preserved.
|
|
153
153
|
- Use bounded source inspection for routine research. Request an independent researcher from the parent only when the scope justifies it and the host supports it.
|
|
154
154
|
|
|
@@ -88,7 +88,7 @@ profile includes neither Screenplay nor Stage.
|
|
|
88
88
|
| Profile ID | Description | Automatically Includes |
|
|
89
89
|
|---|---|---|
|
|
90
90
|
| `cratis/engineering` | Engineering conventions and workflows | `cratis/engineering/core`, `cratis/engineering/csharp`, `cratis/engineering/elixir`, `cratis/engineering/go`, `cratis/engineering/kotlin`, `cratis/engineering/react`, `cratis/engineering/typescript` |
|
|
91
|
-
| `cratis/engineering/core` | Shared engineering method skills: `cratis-ci-pipeline-performance`, `cratis-documentation-writing`, `cratis-engineering-ci-gates`, `cratis-engineering-consolidation-guard`, `cratis-engineering-decision-record`, `cratis-engineering-docs-authoring`, `cratis-engineering-effect-boundaries`, `cratis-engineering-issue-hygiene`, `cratis-engineering-issue-design-note`, `cratis-engineering-local-cross-repo-verification`, `cratis-engineering-regression-cluster`, `cratis-engineering-release-trains`, `cratis-engineering-review-rounds`, `cratis-release-notes`, `cratis-technical-examples` | (no child profiles) |
|
|
91
|
+
| `cratis/engineering/core` | Shared engineering method skills: `cratis-ci-pipeline-performance`, `cratis-documentation-writing`, `cratis-engineering-ci-gates`, `cratis-engineering-consolidation-guard`, `cratis-engineering-decision-record`, `cratis-engineering-docs-authoring`, `cratis-engineering-effect-boundaries`, `cratis-engineering-issue-hygiene`, `cratis-engineering-issue-design-note`, `cratis-engineering-local-cross-repo-verification`, `cratis-engineering-regression-cluster`, `cratis-engineering-release-trains`, `cratis-engineering-review-rounds`, `cratis-release-notes`, `cratis-session-handoff`, `cratis-technical-examples` | (no child profiles) |
|
|
92
92
|
| `cratis/engineering/csharp` | C# engineering conventions, .NET engineering skills, and framework Orleans jobs (`cratis-orleans-jobs`, alongside `orleans.md`) | `cratis/engineering/core`, `cratis/engineering/dotnet` |
|
|
93
93
|
| `cratis/engineering/dotnet` | Upstream .NET engineering workflows | `cratis/engineering/dotnet/performance`, `cratis/engineering/dotnet/diagnostics`, `cratis/engineering/dotnet/msbuild`, `cratis/engineering/dotnet/orleans`, `cratis/engineering/dotnet/testing`, `cratis/engineering/dotnet/refactoring` |
|
|
94
94
|
| `cratis/engineering/dotnet/performance` | Microbenchmarking, performance patterns, SIMD, and profiling | (no child profiles) |
|
|
@@ -144,7 +144,7 @@ For an implemented application slice, require the applicable changed-lane gates
|
|
|
144
144
|
|
|
145
145
|
For large features with many slices, use these techniques to keep context manageable:
|
|
146
146
|
|
|
147
|
-
-
|
|
147
|
+
- Keep a state note and hand off between phases: follow `cratis-session-handoff`.
|
|
148
148
|
- **`/fork`** before exploring an alternative design approach, so the original plan is preserved.
|
|
149
149
|
- Use bounded source inspection for routine research. Request an independent researcher from the parent only when the scope justifies it and the host supports it.
|
|
150
150
|
|
|
@@ -17,6 +17,7 @@ Three layers:
|
|
|
17
17
|
| Cleanup of delivered work | `PostToolUse` on `Bash` (`gh pr merge`, `git pull/merge/worktree`) and `SessionStart` (Pi: `tool_result` and `session_start`) | `scripts/cratis-cleanup-worktrees.sh --hook` | zero when the command is unrelated | never blocks; removes delivered worktrees and branches, reports what it kept |
|
|
18
18
|
| Quality gate (Claude) | `Stop` | `scripts/cratis-quality-gate.sh` | one build/test run, only when relevant files changed | exits **2** — the turn does not end |
|
|
19
19
|
| Quality gate (Pi) | explicit `cratis_quality_gate` tool | same script | only at a requested verification checkpoint | error on failure; no turn-end hook |
|
|
20
|
+
| Handoff checker | not wired: run by the skill | `scripts/cratis-check-handoff.mjs` | local files and git only | errors fail; warnings are advisory unless `--strict` |
|
|
20
21
|
|
|
21
22
|
For false positives, a literal-prefix trailing `*`, including literal directory components, can be
|
|
22
23
|
resolved in a known, readable cwd and parent directory. A single reader may stand alone or appear in
|
|
@@ -504,6 +505,26 @@ build (with `-p:CratisProxiesOutputPath=` per `general.md`, so the proxy generat
|
|
|
504
505
|
re-run and touch already-correct generated files), frontend lint / compile / compile-specs /
|
|
505
506
|
test.
|
|
506
507
|
|
|
508
|
+
## Handoff checker
|
|
509
|
+
|
|
510
|
+
The `cratis-session-handoff` skill runs the harness-neutral validator before ending:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
node .cratis/ai/hooks/scripts/cratis-check-handoff.mjs .ai-work/<task>/handoff.md
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
It checks the fixed template, paths, watch actions, branch/HEAD and state-note freshness.
|
|
517
|
+
With no path it selects the newest `.ai-work/*/handoff*.md`. Use `--repo <dir>` or
|
|
518
|
+
`--state-note <path>` to override those inputs, `--json` for one report object, and
|
|
519
|
+
`--strict` to promote warnings to errors. Exit **0** means no errors, **1** means
|
|
520
|
+
validation failed, and **2** means invalid arguments or an unreadable/non-handoff input.
|
|
521
|
+
Git checks degrade to explicit skips offline or outside a repository; no network is used.
|
|
522
|
+
|
|
523
|
+
This is not an agent-stop hook: a hook cannot reliably choose the active handoff,
|
|
524
|
+
a moved-HEAD warning must not trap a deliberately ending session, and Pi has no
|
|
525
|
+
turn-end hook. Follow-up: consider Stop wiring when a handoff newer than the last
|
|
526
|
+
commit can be identified without guessing; keep the standalone command portable.
|
|
527
|
+
|
|
507
528
|
## The package drift guards
|
|
508
529
|
|
|
509
530
|
Three scripts sit outside the three layers and are not bound to a hook event: run
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
3
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
|
+
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
7
|
+
import { dirname, join, resolve } from 'node:path';
|
|
8
|
+
import { parseArgs } from 'node:util';
|
|
9
|
+
|
|
10
|
+
const headings = [
|
|
11
|
+
'Goal', 'Repositories and worktrees', 'Verified facts (with evidence)',
|
|
12
|
+
'Plans and hypotheses (not verified)', 'Watch and action', 'Finished, results not yet read',
|
|
13
|
+
'Open questions carried forward', 'User constraints (verbatim)',
|
|
14
|
+
'User instructions since the last handoff (verbatim)', 'Next commands', 'Files to read',
|
|
15
|
+
];
|
|
16
|
+
const repositoryHeader = ['Path', 'Repository', 'Branch', 'HEAD (full SHA)', 'State', 'Ahead/behind'];
|
|
17
|
+
const watchHeader = ['Id', 'Target (immutable)', 'Action on completion', 'How to cancel'];
|
|
18
|
+
const clean = value => value.trim().replace(/^`(.*)`$/, '$1').trim();
|
|
19
|
+
const absent = value => !value || clean(value).toLowerCase() === 'none';
|
|
20
|
+
|
|
21
|
+
function git(directory, args) {
|
|
22
|
+
const result = spawnSync('git', ['-C', directory, ...args], { encoding: 'utf8', timeout: 15_000 });
|
|
23
|
+
return {
|
|
24
|
+
ok: result.status === 0,
|
|
25
|
+
output: result.stdout?.trim() || '',
|
|
26
|
+
reason: result.stderr?.trim() || result.error?.message || `git exited ${result.status}`,
|
|
27
|
+
status: result.status,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function argumentsFor(argv) {
|
|
32
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: {
|
|
33
|
+
json: { type: 'boolean' }, strict: { type: 'boolean' },
|
|
34
|
+
repo: { type: 'string' }, 'state-note': { type: 'string' },
|
|
35
|
+
} });
|
|
36
|
+
if (positionals.length > 1) throw new Error('Expected at most one handoff path.');
|
|
37
|
+
return { ...values, path: positionals[0] };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function fallbackRoot(directory) {
|
|
41
|
+
let current = directory;
|
|
42
|
+
while (true) {
|
|
43
|
+
if (existsSync(join(current, '.ai-work'))) return current;
|
|
44
|
+
const parent = dirname(current);
|
|
45
|
+
if (parent === current) return directory;
|
|
46
|
+
current = parent;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function newestHandoff(root) {
|
|
51
|
+
const work = join(root, '.ai-work');
|
|
52
|
+
if (!existsSync(work)) throw new Error(`No handoff found under ${work}.`);
|
|
53
|
+
const candidates = readdirSync(work, { withFileTypes: true }).filter(entry => entry.isDirectory())
|
|
54
|
+
.flatMap(entry => readdirSync(join(work, entry.name))
|
|
55
|
+
.filter(name => /^handoff.*\.md$/.test(name)).map(name => join(work, entry.name, name)))
|
|
56
|
+
.filter(path => statSync(path).isFile())
|
|
57
|
+
.sort((left, right) => statSync(right).mtimeMs - statSync(left).mtimeMs || left.localeCompare(right));
|
|
58
|
+
if (!candidates.length) throw new Error(`No handoff found under ${work}/*/handoff*.md.`);
|
|
59
|
+
return candidates[0];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function input(options) {
|
|
63
|
+
const start = resolve(options.repo || process.cwd());
|
|
64
|
+
const discoveryRoot = git(start, ['rev-parse', '--show-toplevel']);
|
|
65
|
+
const searchRoot = options.repo ? start : discoveryRoot.output || fallbackRoot(start);
|
|
66
|
+
const handoff = options.path ? resolve(options.path) : newestHandoff(searchRoot);
|
|
67
|
+
const body = readFileSync(handoff, 'utf8');
|
|
68
|
+
if (!/^# Handoff:.*$/m.test(body)) throw new Error(`Not a handoff: ${handoff} (missing # Handoff: title).`);
|
|
69
|
+
const repository = git(options.repo ? start : dirname(handoff), ['rev-parse', '--show-toplevel']);
|
|
70
|
+
const repoRoot = options.repo ? start : repository.output || fallbackRoot(dirname(handoff));
|
|
71
|
+
return { handoff, body, repoRoot, hasGit: repository.ok };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function findings(options, document) {
|
|
75
|
+
const report = { ok: true, handoff: document.handoff, repoRoot: document.repoRoot, errors: [], warnings: [], skipped: [] };
|
|
76
|
+
const add = (severity, code, message, line) => {
|
|
77
|
+
if (options.strict && severity === 'warning') severity = 'error';
|
|
78
|
+
const finding = { severity, code, message, ...(line ? { line } : {}) };
|
|
79
|
+
report[severity === 'error' ? 'errors' : 'warnings'].push(finding);
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
report,
|
|
83
|
+
error: (code, message, line) => add('error', code, message, line),
|
|
84
|
+
warning: (code, message, line) => add('warning', code, message, line),
|
|
85
|
+
skip: (check, reason) => report.skipped.push({ check, reason }),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function splitSections(body) {
|
|
90
|
+
const sections = new Map();
|
|
91
|
+
const order = [];
|
|
92
|
+
let section;
|
|
93
|
+
for (const [index, text] of body.split(/\r?\n/).entries()) {
|
|
94
|
+
if (text.startsWith('## ')) {
|
|
95
|
+
const name = text.slice(3);
|
|
96
|
+
order.push(name);
|
|
97
|
+
section = { line: index + 1, lines: [] };
|
|
98
|
+
sections.set(name, section);
|
|
99
|
+
} else if (section) section.lines.push({ text, line: index + 1 });
|
|
100
|
+
}
|
|
101
|
+
return { sections, order };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function checkSection(name, section, context) {
|
|
105
|
+
if (!section) context.error('section-missing', `Missing section: ${name}.`);
|
|
106
|
+
else if (!section.lines.some(item => item.text.trim())) context.warning('section-empty', `Write none in empty section: ${name}.`, section.line);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function sectionsOf(body, context) {
|
|
110
|
+
const { sections, order } = splitSections(body);
|
|
111
|
+
for (const name of headings) checkSection(name, sections.get(name), context);
|
|
112
|
+
const expected = headings.filter(name => sections.has(name));
|
|
113
|
+
if (order.join('\n') !== expected.join('\n')) context.error('section-order', 'Sections must use the template headings in order.');
|
|
114
|
+
return sections;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function cellsOf(text) {
|
|
118
|
+
return text.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(clean);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function tableRows(section, header, context) {
|
|
122
|
+
if (!section) return [];
|
|
123
|
+
const lines = section.lines.filter(item => item.text.trim().startsWith('|'));
|
|
124
|
+
const first = lines[0];
|
|
125
|
+
if (!first || JSON.stringify(cellsOf(first.text)) !== JSON.stringify(header)) {
|
|
126
|
+
context.error('table-header', `Expected table header: | ${header.join(' | ')} |.`, first?.line || section.line);
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
return lines.slice(1).filter(item => !/^\|?\s*:?-+/.test(item.text.trim()))
|
|
130
|
+
.map(item => ({ cells: cellsOf(item.text), line: item.line }));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function bullets(section) {
|
|
134
|
+
return (section?.lines || []).filter(item => /^\s*[-*+]\s+/.test(item.text))
|
|
135
|
+
.map(item => ({ text: item.text.replace(/^\s*[-*+]\s+/, '').trim(), line: item.line }));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function pathFrom(root, value) {
|
|
139
|
+
const path = clean(value);
|
|
140
|
+
if (absent(path) || path.startsWith('~')) return undefined;
|
|
141
|
+
return resolve(root, path);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function readPaths(sections, root, context) {
|
|
145
|
+
const paths = bullets(sections.get('Files to read')).map(item => ({ ...item, text: clean(item.text) }))
|
|
146
|
+
.filter(item => !absent(item.text));
|
|
147
|
+
for (const item of paths) {
|
|
148
|
+
const path = pathFrom(root, item.text);
|
|
149
|
+
if (!path || !existsSync(path)) context.error('files-to-read-missing', `Cannot resolve Files to read path: ${item.text}.`, item.line);
|
|
150
|
+
}
|
|
151
|
+
return paths;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function watchRows(rows, context) {
|
|
155
|
+
for (const { cells, line } of rows) {
|
|
156
|
+
const [id, target = '', action = '', cancel = ''] = cells;
|
|
157
|
+
if (absent(id)) continue;
|
|
158
|
+
if (absent(action)) context.error('watch-action-missing', `Watch ${id} needs an Action on completion.`, line);
|
|
159
|
+
if (absent(target) || /^(latest|the PR|current)$/i.test(target)) context.error('watch-target-mutable', `Watch ${id} needs an immutable target, not ${target || 'an empty cell'}.`, line);
|
|
160
|
+
if (absent(cancel)) context.warning('watch-cancel-missing', `Watch ${id} needs How to cancel.`, line);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function unreadResults(section, root, context) {
|
|
165
|
+
for (const item of bullets(section)) {
|
|
166
|
+
for (const match of item.text.matchAll(/`([^`]+)`/g)) {
|
|
167
|
+
const path = pathFrom(root, match[1]);
|
|
168
|
+
if (!path || !existsSync(path)) context.warning('result-missing', `Unread result path does not exist: ${match[1]}.`, item.line);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function gitValue(directory, args, label, context) {
|
|
174
|
+
const result = git(directory, args);
|
|
175
|
+
if (!result.ok) context.skip(label, result.reason);
|
|
176
|
+
return result.ok ? result.output : undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function compareBranch(repository, branch, context) {
|
|
180
|
+
const { directory, label, line } = repository;
|
|
181
|
+
const actual = gitValue(directory, ['branch', '--show-current'], `${label}: branch`, context);
|
|
182
|
+
if (actual !== undefined && actual !== branch) context.error('branch-mismatch', `${label}: branch is ${actual || '(detached)'}, recorded ${branch}.`, line);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function compareHead(repository, recorded, context) {
|
|
186
|
+
const { directory, label, line } = repository;
|
|
187
|
+
if (!/^[a-f\d]{40}$/i.test(recorded)) {
|
|
188
|
+
context.error('sha-malformed', `${label}: expected a full 40-character hexadecimal SHA, got ${recorded}.`, line);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const actual = gitValue(directory, ['rev-parse', 'HEAD'], `${label}: HEAD`, context);
|
|
192
|
+
if (actual === undefined || actual === recorded.toLowerCase()) return;
|
|
193
|
+
const ancestry = git(directory, ['merge-base', '--is-ancestor', recorded, actual]);
|
|
194
|
+
if (ancestry.ok) context.warning('head-moved', `${label}: HEAD moved from ${recorded} to ${actual}.`, line);
|
|
195
|
+
else if (ancestry.status === 1 || /(?:not a valid|bad object|invalid|unknown revision)/i.test(ancestry.reason)) {
|
|
196
|
+
context.error('head-unrelated', `${label}: recorded HEAD ${recorded} is not an ancestor of ${actual}.`, line);
|
|
197
|
+
} else context.skip(`${label}: ancestry`, ancestry.reason);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function checkRepository(row, document, context) {
|
|
201
|
+
const [path, , branch = '', sha = ''] = row.cells;
|
|
202
|
+
if (absent(path)) return undefined;
|
|
203
|
+
const directory = pathFrom(document.repoRoot, path);
|
|
204
|
+
if (!directory || !existsSync(directory)) {
|
|
205
|
+
context.error('worktree-missing', `Cannot resolve worktree: ${path}.`, row.line);
|
|
206
|
+
context.skip(`repository ${path}`, `worktree-missing: ${path}`);
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
if (!document.hasGit) {
|
|
210
|
+
context.skip(`repository ${path}`, 'no-git-repository');
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const repository = { directory, branch, sha, line: row.line, label: path };
|
|
214
|
+
compareBranch(repository, branch, context);
|
|
215
|
+
compareHead(repository, sha, context);
|
|
216
|
+
return repository;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function preconditions(body, first, context) {
|
|
220
|
+
if (!first) return;
|
|
221
|
+
const text = body.split(/^## /m)[0];
|
|
222
|
+
const branch = /\bbranch\s+`([^`]+)`/i.exec(text)?.[1];
|
|
223
|
+
const sha = /\bHEAD\s+`([^`]+)`/.exec(text)?.[1];
|
|
224
|
+
const repository = { ...first, label: 'preconditions', line: undefined };
|
|
225
|
+
if (branch && branch !== first.branch) compareBranch(repository, branch, context);
|
|
226
|
+
if (sha && sha !== first.sha) compareHead(repository, sha, context);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function stateNotePath(options, document, paths) {
|
|
230
|
+
const named = paths.find(item => /(^|\/)STATE\.md$/.test(item.text));
|
|
231
|
+
const sibling = join(dirname(document.handoff), 'STATE.md');
|
|
232
|
+
const value = options['state-note'] || named?.text || sibling;
|
|
233
|
+
return pathFrom(document.repoRoot, value);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function stateNote(note, first, document, context) {
|
|
237
|
+
if (!note || !existsSync(note)) {
|
|
238
|
+
context.skip('state-note', 'no-state-note');
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (!first) {
|
|
242
|
+
context.skip('state-note', document.hasGit ? 'no-repository-row' : 'no-git-repository');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const timestamp = gitValue(first.directory, ['log', '-1', '--format=%ct'], 'state-note: commit time', context);
|
|
246
|
+
if (timestamp !== undefined && statSync(note).mtimeMs < Number(timestamp) * 1000) {
|
|
247
|
+
context.warning('state-note-stale', `State note ${note} is older than the branch tip.`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function validate(options, document) {
|
|
252
|
+
const context = findings(options, document);
|
|
253
|
+
const sections = sectionsOf(document.body, context);
|
|
254
|
+
const rows = tableRows(sections.get('Repositories and worktrees'), repositoryHeader, context);
|
|
255
|
+
const watches = tableRows(sections.get('Watch and action'), watchHeader, context);
|
|
256
|
+
const paths = readPaths(sections, document.repoRoot, context);
|
|
257
|
+
watchRows(watches, context);
|
|
258
|
+
unreadResults(sections.get('Finished, results not yet read'), document.repoRoot, context);
|
|
259
|
+
const checked = rows.map(row => checkRepository(row, document, context));
|
|
260
|
+
preconditions(document.body, checked[0], context);
|
|
261
|
+
stateNote(stateNotePath(options, document, paths), checked[0], document, context);
|
|
262
|
+
if (!document.hasGit) context.skip('git preconditions', 'no-git-repository');
|
|
263
|
+
context.report.ok = context.report.errors.length === 0;
|
|
264
|
+
return context.report;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function print(report, json) {
|
|
268
|
+
if (json) {
|
|
269
|
+
console.log(JSON.stringify(report));
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
console.log(`handoff: ${report.handoff} (repo root: ${report.repoRoot})`);
|
|
273
|
+
for (const finding of [...report.errors, ...report.warnings]) console.log(`${finding.severity} ${finding.code}: ${finding.message}`);
|
|
274
|
+
for (const skipped of report.skipped) console.log(`skipped: ${skipped.check}: ${skipped.reason}`);
|
|
275
|
+
console.log(`handoff ${report.ok ? 'OK' : 'FAILED'} (${report.errors.length} errors, ${report.warnings.length} warnings, ${report.skipped.length} checks skipped)`);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
try {
|
|
279
|
+
const options = argumentsFor(process.argv.slice(2));
|
|
280
|
+
const report = validate(options, input(options));
|
|
281
|
+
print(report, options.json);
|
|
282
|
+
process.exitCode = report.ok ? 0 : 1;
|
|
283
|
+
} catch (error) {
|
|
284
|
+
console.error(error.message);
|
|
285
|
+
process.exitCode = 2;
|
|
286
|
+
}
|
|
@@ -87,7 +87,7 @@ profile includes neither Screenplay nor Stage.
|
|
|
87
87
|
| Profile ID | Description | Automatically Includes |
|
|
88
88
|
|---|---|---|
|
|
89
89
|
| `cratis/engineering` | Engineering conventions and workflows | `cratis/engineering/core`, `cratis/engineering/csharp`, `cratis/engineering/elixir`, `cratis/engineering/go`, `cratis/engineering/kotlin`, `cratis/engineering/react`, `cratis/engineering/typescript` |
|
|
90
|
-
| `cratis/engineering/core` | Shared engineering method skills: `cratis-ci-pipeline-performance`, `cratis-documentation-writing`, `cratis-engineering-ci-gates`, `cratis-engineering-consolidation-guard`, `cratis-engineering-decision-record`, `cratis-engineering-docs-authoring`, `cratis-engineering-effect-boundaries`, `cratis-engineering-issue-hygiene`, `cratis-engineering-issue-design-note`, `cratis-engineering-local-cross-repo-verification`, `cratis-engineering-regression-cluster`, `cratis-engineering-release-trains`, `cratis-engineering-review-rounds`, `cratis-release-notes`, `cratis-technical-examples` | (no child profiles) |
|
|
90
|
+
| `cratis/engineering/core` | Shared engineering method skills: `cratis-ci-pipeline-performance`, `cratis-documentation-writing`, `cratis-engineering-ci-gates`, `cratis-engineering-consolidation-guard`, `cratis-engineering-decision-record`, `cratis-engineering-docs-authoring`, `cratis-engineering-effect-boundaries`, `cratis-engineering-issue-hygiene`, `cratis-engineering-issue-design-note`, `cratis-engineering-local-cross-repo-verification`, `cratis-engineering-regression-cluster`, `cratis-engineering-release-trains`, `cratis-engineering-review-rounds`, `cratis-release-notes`, `cratis-session-handoff`, `cratis-technical-examples` | (no child profiles) |
|
|
91
91
|
| `cratis/engineering/csharp` | C# engineering conventions, .NET engineering skills, and framework Orleans jobs (`cratis-orleans-jobs`, alongside `orleans.md`) | `cratis/engineering/core`, `cratis/engineering/dotnet` |
|
|
92
92
|
| `cratis/engineering/dotnet` | Upstream .NET engineering workflows | `cratis/engineering/dotnet/performance`, `cratis/engineering/dotnet/diagnostics`, `cratis/engineering/dotnet/msbuild`, `cratis/engineering/dotnet/orleans`, `cratis/engineering/dotnet/testing`, `cratis/engineering/dotnet/refactoring` |
|
|
93
93
|
| `cratis/engineering/dotnet/performance` | Microbenchmarking, performance patterns, SIMD, and profiling | (no child profiles) |
|
|
@@ -105,10 +105,10 @@ Everything else a lane decides, records and reports.
|
|
|
105
105
|
|
|
106
106
|
## Context handoff
|
|
107
107
|
|
|
108
|
-
When a lane must stop and another session continues, write a handoff
|
|
109
|
-
|
|
110
|
-
[
|
|
111
|
-
preconditions rule
|
|
108
|
+
When a lane must stop and another session continues, write a handoff named
|
|
109
|
+
`handoff-<lane-id>.md` under the task folder. Structure, filling rules and
|
|
110
|
+
resuming follow [cratis-session-handoff](../cratis-session-handoff/SKILL.md);
|
|
111
|
+
the preconditions rule lives in
|
|
112
112
|
[local-work-artifacts.md](../../rules/local-work-artifacts.md).
|
|
113
113
|
|
|
114
114
|
## Roll call
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{ "kind": "skill-contains", "value": "Record every takeover in the register" },
|
|
9
9
|
{ "kind": "skill-contains", "value": "references/inbox-and-handover.md" },
|
|
10
10
|
{ "kind": "skill-contains", "value": "references/lane-brief.md" },
|
|
11
|
-
{ "kind": "skill-contains", "value": "
|
|
11
|
+
{ "kind": "skill-contains", "value": "../cratis-session-handoff/SKILL.md" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "Stopping and escalating never wait" },
|
|
13
13
|
{ "kind": "skill-contains", "value": "Answer from evidence, not memory" }
|
|
14
14
|
]
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cratis-session-handoff
|
|
3
|
+
description: Use when a long session nears its context limit, a milestone ends, or work must continue in a fresh session; also for keeping a running state note. Not for coordinating parallel lanes (cratis-orchestration-lanes).
|
|
4
|
+
license: LICENSE
|
|
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
|
+
# Hand off a session without losing state
|
|
11
|
+
|
|
12
|
+
A session ends sooner than the task does. The state that matters (running jobs,
|
|
13
|
+
other worktrees, unanswered questions, the user's exact words) lives only in
|
|
14
|
+
the session's context, so it is written down while the session is healthy, not
|
|
15
|
+
reconstructed after it degrades. This skill covers one agent continuing its own
|
|
16
|
+
task in a later session. Parallel lanes with claims, leases and inboxes use
|
|
17
|
+
`cratis-orchestration-lanes`, which reuses the template here.
|
|
18
|
+
|
|
19
|
+
Work records live under `.ai-work/` as defined in
|
|
20
|
+
[local-work-artifacts.md](../../rules/local-work-artifacts.md), which also owns
|
|
21
|
+
the preconditions every handoff opens with.
|
|
22
|
+
|
|
23
|
+
## Keep a state note
|
|
24
|
+
|
|
25
|
+
Default: keep `.ai-work/<task>/STATE.md` from the start of any task expected to
|
|
26
|
+
span more than one sitting. It holds the same sections as the handoff template,
|
|
27
|
+
so a handoff is a copy plus a verification, not a reconstruction.
|
|
28
|
+
|
|
29
|
+
Update it at each milestone and before any long wait. Also update it
|
|
30
|
+
immediately after:
|
|
31
|
+
|
|
32
|
+
- launching a job, subagent or CI watch (record its immutable id and what to do
|
|
33
|
+
when it finishes);
|
|
34
|
+
- receiving a user instruction (quote it verbatim);
|
|
35
|
+
- asking or answering a question (record the question and its status).
|
|
36
|
+
|
|
37
|
+
A note updated only at the end is the one that is missing when the session is
|
|
38
|
+
cut off.
|
|
39
|
+
|
|
40
|
+
## When to hand off
|
|
41
|
+
|
|
42
|
+
Hand off at a milestone, or when the context is nearly full: by default at
|
|
43
|
+
about 60-70% used or when the harness warns. A repository or brief may set
|
|
44
|
+
another threshold; harnesses differ in how they report usage. Hand off at a
|
|
45
|
+
boundary, never mid-atomic-step: a half-finished edit or half-run command
|
|
46
|
+
cannot be described reliably.
|
|
47
|
+
|
|
48
|
+
When the context is nearly full:
|
|
49
|
+
|
|
50
|
+
1. Finish the current atomic step.
|
|
51
|
+
2. Update `STATE.md`.
|
|
52
|
+
3. Write the handoff from it. Read
|
|
53
|
+
[references/handoff-template.md](references/handoff-template.md) for the
|
|
54
|
+
fixed structure, the rules for filling it and a worked example.
|
|
55
|
+
4. Verify it: run `node .cratis/ai/hooks/scripts/cratis-check-handoff.mjs .ai-work/<task>/handoff.md`;
|
|
56
|
+
fix every error and either fix or acknowledge each warning (a moved HEAD means
|
|
57
|
+
update the table). Where the script is not installed, check by hand:
|
|
58
|
+
preconditions against `git`, each section present, every running job with a
|
|
59
|
+
full watch row.
|
|
60
|
+
5. End the session, or reset it with your harness's compaction or new-session
|
|
61
|
+
command, starting from the handoff.
|
|
62
|
+
|
|
63
|
+
## Session hygiene
|
|
64
|
+
|
|
65
|
+
- One repository and one task per session. A second task makes the handoff
|
|
66
|
+
ambiguous about what is current.
|
|
67
|
+
- At a milestone, start a fresh session from a handoff instead of running one
|
|
68
|
+
session all day; quality drops as context fills.
|
|
69
|
+
- Delegate log, diff and CI digests where the harness allows it; reading raw
|
|
70
|
+
output spends context on bytes the decision does not need.
|
|
71
|
+
- A truncated view is never gate evidence. Read the full result or the exit
|
|
72
|
+
code before claiming a check passed.
|
|
73
|
+
- Explore an alternative design in a branch of the session or a fresh one, so
|
|
74
|
+
the original plan is preserved.
|
|
75
|
+
|
|
76
|
+
## Resuming
|
|
77
|
+
|
|
78
|
+
Start from the handoff, not from memory:
|
|
79
|
+
|
|
80
|
+
1. Run `git rev-parse --show-toplevel`, `git rev-parse HEAD`,
|
|
81
|
+
`git branch --show-current` and `git worktree list`; compare with the
|
|
82
|
+
preconditions and the repositories table.
|
|
83
|
+
2. Read the finished, unread results first.
|
|
84
|
+
3. Reconcile every watch row against the real state of its target; decide each
|
|
85
|
+
action from that state.
|
|
86
|
+
4. Re-read the verbatim constraints and instructions before the next command.
|
|
87
|
+
|
|
88
|
+
A stale handoff is not a lost one: a mismatch means the work moved. Find it
|
|
89
|
+
through branches, the reflog and open pull requests before recreating or
|
|
90
|
+
resetting anything.
|
|
91
|
+
|
|
92
|
+
## Pitfalls
|
|
93
|
+
|
|
94
|
+
- **Unrecorded jobs and subagents.** A job started and never written down is
|
|
95
|
+
orphaned by the reset. Record it the moment it starts.
|
|
96
|
+
- **Other repositories and worktrees.** Work in a second checkout is invisible
|
|
97
|
+
to a note that names only the current one; list every path in the table.
|
|
98
|
+
- **Questions from earlier sessions.** An open question forgotten is a
|
|
99
|
+
decision made by default. Carry it forward with who asked and its status.
|
|
100
|
+
- **Paraphrased user words.** A summary drops the condition that mattered.
|
|
101
|
+
Quote constraints and instructions exactly.
|
|
102
|
+
|
|
103
|
+
## Verification
|
|
104
|
+
|
|
105
|
+
A handoff is complete when every heading of the template is present in order,
|
|
106
|
+
the repositories and watch tables use the exact header rows, every running job,
|
|
107
|
+
CI watch and subagent has a row with an immutable target, and each user quote
|
|
108
|
+
is verbatim. Run `node .cratis/ai/hooks/scripts/cratis-check-handoff.mjs .ai-work/<task>/handoff.md`;
|
|
109
|
+
the checker exits 0. Fix or acknowledge its warnings before ending the session.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
4
|
+
# Handoff template
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Template
|
|
9
|
+
- Rules for filling it in
|
|
10
|
+
- Filled example
|
|
11
|
+
|
|
12
|
+
A handoff lets a fresh session continue work. Save it as
|
|
13
|
+
`.ai-work/<task>/handoff.md`; a lane uses `.ai-work/<task>/handoff-<lane-id>.md`.
|
|
14
|
+
It opens with the preconditions (repository, branch, expected `HEAD`, worktree
|
|
15
|
+
paths, date) required by
|
|
16
|
+
[local-work-artifacts.md](../../../rules/local-work-artifacts.md). The next
|
|
17
|
+
session compares them with `git` before acting; a mismatch means the handoff is
|
|
18
|
+
stale, not that the work is lost.
|
|
19
|
+
|
|
20
|
+
The structure is fixed so a tool can check it: the headings below appear
|
|
21
|
+
exactly as spelled, in this order, and the table headers are not reworded.
|
|
22
|
+
Every section is present even when empty; write `none` so an absence is
|
|
23
|
+
detectable and never ambiguous.
|
|
24
|
+
|
|
25
|
+
## Template
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Handoff: <task>
|
|
29
|
+
|
|
30
|
+
**Preconditions:** repository `<repo>`, branch `<branch>`, HEAD `<full-sha>`,
|
|
31
|
+
worktrees `<paths>`, written `<date>`.
|
|
32
|
+
|
|
33
|
+
## Goal
|
|
34
|
+
<one sentence>
|
|
35
|
+
|
|
36
|
+
## Repositories and worktrees
|
|
37
|
+
| Path | Repository | Branch | HEAD (full SHA) | State | Ahead/behind |
|
|
38
|
+
|---|---|---|---|---|---|
|
|
39
|
+
| <path> | <repository> | <branch> | <full-sha> | <clean or dirty> | <ahead/behind> |
|
|
40
|
+
|
|
41
|
+
## Verified facts (with evidence)
|
|
42
|
+
- <fact>: <evidence: command run, SHA, run id>
|
|
43
|
+
|
|
44
|
+
## Plans and hypotheses (not verified)
|
|
45
|
+
- <plan or guess>
|
|
46
|
+
|
|
47
|
+
## Watch and action
|
|
48
|
+
| Id | Target (immutable) | Action on completion | How to cancel |
|
|
49
|
+
|---|---|---|---|
|
|
50
|
+
| <job, run or subagent id> | <run id, head SHA or job id> | <what to do> | <command or step> |
|
|
51
|
+
|
|
52
|
+
## Finished, results not yet read
|
|
53
|
+
- <job id>: <where the result lives>
|
|
54
|
+
|
|
55
|
+
## Open questions carried forward
|
|
56
|
+
- <question>: <who asked and when>, <status>
|
|
57
|
+
|
|
58
|
+
## User constraints (verbatim)
|
|
59
|
+
> <quoted exactly, never paraphrased>
|
|
60
|
+
|
|
61
|
+
## User instructions since the last handoff (verbatim)
|
|
62
|
+
> <quoted exactly, or none>
|
|
63
|
+
|
|
64
|
+
## Next commands
|
|
65
|
+
1. `<command>`
|
|
66
|
+
|
|
67
|
+
## Files to read
|
|
68
|
+
- `<path>`
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Rules for filling it in
|
|
72
|
+
|
|
73
|
+
- State is `clean` or `dirty`, nothing else. Ahead/behind is relative to the
|
|
74
|
+
branch's upstream.
|
|
75
|
+
- Facts and plans stay in separate sections. A claim without evidence is a plan.
|
|
76
|
+
- The watch table has one row per running job, CI watch or subagent. The target
|
|
77
|
+
is an immutable identifier (run id, pull request head SHA, job id), never
|
|
78
|
+
"latest" or "the PR", because the thing it points to moves.
|
|
79
|
+
- When nothing runs, the watch table keeps one row whose cells say `none`.
|
|
80
|
+
- Results that finished but were never read go under their own heading so the
|
|
81
|
+
next session reads them first.
|
|
82
|
+
- Quote user words exactly. A paraphrase loses the constraint's edges.
|
|
83
|
+
|
|
84
|
+
## Filled example
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Handoff: export retry cap
|
|
88
|
+
|
|
89
|
+
**Preconditions:** repository `export-service`, branch `export-retry`, HEAD
|
|
90
|
+
`0123456789abcdef0123456789abcdef01234567`, worktrees
|
|
91
|
+
`../.worktrees/export-retry` and `../.worktrees/export-docs-retry`, written
|
|
92
|
+
2025-01-01.
|
|
93
|
+
|
|
94
|
+
## Goal
|
|
95
|
+
Cap export retries at five and surface the final failure.
|
|
96
|
+
|
|
97
|
+
## Repositories and worktrees
|
|
98
|
+
| Path | Repository | Branch | HEAD (full SHA) | State | Ahead/behind |
|
|
99
|
+
|---|---|---|---|---|---|
|
|
100
|
+
| ../.worktrees/export-retry | export-service | export-retry | 0123456789abcdef0123456789abcdef01234567 | clean | 2/0 |
|
|
101
|
+
| ../.worktrees/export-docs-retry | export-docs | export-retry-docs | 89abcdef0123456789abcdef0123456789abcdef | dirty | 1/0 |
|
|
102
|
+
|
|
103
|
+
## Verified facts (with evidence)
|
|
104
|
+
- Cap and spec committed: `git log -1` shows the SHA above.
|
|
105
|
+
- Spec project passes: `./Source/Export.Specs/bin/Debug/net10.0/Export.Specs` exit 0 at that SHA.
|
|
106
|
+
- Pull request is open: `gh pr list --head export-retry` shows one entry.
|
|
107
|
+
|
|
108
|
+
## Plans and hypotheses (not verified)
|
|
109
|
+
- The integration job may need the same cap; not inspected.
|
|
110
|
+
|
|
111
|
+
## Watch and action
|
|
112
|
+
| Id | Target (immutable) | Action on completion | How to cancel |
|
|
113
|
+
|---|---|---|---|
|
|
114
|
+
| ci-1 | CI run `1234567890` on head `0123456789abcdef0123456789abcdef01234567` | fails: read the failing job log, fix in owned files; passes: report ready | `gh run cancel 1234567890` |
|
|
115
|
+
|
|
116
|
+
## Finished, results not yet read
|
|
117
|
+
- review-1: findings are in `.ai-work/export-retry/review-1.md`
|
|
118
|
+
|
|
119
|
+
## Open questions carried forward
|
|
120
|
+
- Should the cap be configurable per tenant: asked by the user in the first session, unanswered.
|
|
121
|
+
|
|
122
|
+
## User constraints (verbatim)
|
|
123
|
+
> Do not change the public job interface.
|
|
124
|
+
|
|
125
|
+
## User instructions since the last handoff (verbatim)
|
|
126
|
+
> none
|
|
127
|
+
|
|
128
|
+
## Next commands
|
|
129
|
+
1. `git rev-parse HEAD` and compare with the preconditions
|
|
130
|
+
2. `gh run view 1234567890 --json status,conclusion`
|
|
131
|
+
|
|
132
|
+
## Files to read
|
|
133
|
+
- `Source/Export/ExportJob.cs`
|
|
134
|
+
- `.ai-work/export-retry/STATE.md`
|
|
135
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill": "cratis-session-handoff",
|
|
3
|
+
"input": "A long single session is nearly out of context with a CI run in progress and an unanswered question; hand it off.",
|
|
4
|
+
"fixtures": [],
|
|
5
|
+
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": ".ai-work/<task>/STATE.md" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "references/handoff-template.md" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "never mid-atomic-step" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "A stale handoff is not a lost one" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "A truncated view is never gate evidence" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "cratis-orchestration-lanes" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "cratis-check-handoff.mjs" },
|
|
13
|
+
{ "kind": "skill-contains", "value": "exits 0" }
|
|
14
|
+
]
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
-
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
-
|
|
4
|
-
# Context handoff
|
|
5
|
-
|
|
6
|
-
A handoff lets a fresh session continue work. Save it as
|
|
7
|
-
`<work-root>/<task>/handoff-<lane-id>.md`. It opens with the preconditions
|
|
8
|
-
(repository, branch, expected `HEAD`, worktree paths, date) required by
|
|
9
|
-
[local-work-artifacts.md](../../../rules/local-work-artifacts.md). The next
|
|
10
|
-
session compares them with `git` before acting; a mismatch means the handoff is
|
|
11
|
-
stale, not that the work is lost.
|
|
12
|
-
|
|
13
|
-
## Template
|
|
14
|
-
|
|
15
|
-
```markdown
|
|
16
|
-
# Handoff: <task>, lane <lane-id>
|
|
17
|
-
|
|
18
|
-
**Preconditions:** repository `<repo>`, branch `<branch>`, HEAD `<full-sha>`,
|
|
19
|
-
worktrees `<paths>`, written `<date>`.
|
|
20
|
-
|
|
21
|
-
## Goal
|
|
22
|
-
<one sentence>
|
|
23
|
-
|
|
24
|
-
## Verified facts (with evidence)
|
|
25
|
-
- <fact>: <evidence: command run, SHA, run id>
|
|
26
|
-
|
|
27
|
-
## Plans and hypotheses (not verified)
|
|
28
|
-
- <plan or guess>
|
|
29
|
-
|
|
30
|
-
## Watch and action
|
|
31
|
-
| Watch | When it changes | Action |
|
|
32
|
-
|---|---|---|
|
|
33
|
-
| <thing to observe> | <condition> | <what to do> |
|
|
34
|
-
|
|
35
|
-
## User constraints (verbatim)
|
|
36
|
-
> <quoted exactly, never paraphrased>
|
|
37
|
-
|
|
38
|
-
## Next commands
|
|
39
|
-
1. `<command>`
|
|
40
|
-
|
|
41
|
-
## Files to read
|
|
42
|
-
- `<path>`
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Keep facts and plans in separate sections. A claim without evidence belongs
|
|
46
|
-
under plans.
|
|
47
|
-
|
|
48
|
-
## Filled example
|
|
49
|
-
|
|
50
|
-
```markdown
|
|
51
|
-
# Handoff: export retry cap, lane A1
|
|
52
|
-
|
|
53
|
-
**Preconditions:** repository `<repo>`, branch `export-retry`, HEAD
|
|
54
|
-
`0123456789abcdef0123456789abcdef01234567`, worktree `../.worktrees/export-retry`,
|
|
55
|
-
written 2025-01-01.
|
|
56
|
-
|
|
57
|
-
## Goal
|
|
58
|
-
Cap export retries at five and surface the final failure.
|
|
59
|
-
|
|
60
|
-
## Verified facts (with evidence)
|
|
61
|
-
- Cap and spec committed: `git log -1` shows the SHA above.
|
|
62
|
-
- Spec project passes: `./Source/Export.Specs/bin/Debug/net10.0/Export.Specs` exit 0 at that SHA.
|
|
63
|
-
- Pull request is open: `gh pr list --head export-retry` shows one entry; CI run
|
|
64
|
-
`1234567890` is in progress.
|
|
65
|
-
|
|
66
|
-
## Plans and hypotheses (not verified)
|
|
67
|
-
- The integration job may need the same cap; not inspected.
|
|
68
|
-
|
|
69
|
-
## Watch and action
|
|
70
|
-
| Watch | When it changes | Action |
|
|
71
|
-
|---|---|---|
|
|
72
|
-
| CI run `1234567890` | fails | read the failing job log, fix in owned files |
|
|
73
|
-
| PR review | blocking finding | start a delta round, not a restart |
|
|
74
|
-
|
|
75
|
-
## User constraints (verbatim)
|
|
76
|
-
> Do not change the public job interface.
|
|
77
|
-
|
|
78
|
-
## Next commands
|
|
79
|
-
1. `git rev-parse HEAD` and compare with the preconditions
|
|
80
|
-
2. `gh run view 1234567890 --json status,conclusion`
|
|
81
|
-
|
|
82
|
-
## Files to read
|
|
83
|
-
- `Source/Export/ExportJob.cs`
|
|
84
|
-
- `.ai-work/export-retry/brief-A1.md`
|
|
85
|
-
```
|