@kitman-sh/software-engineering 0.13.9 → 0.13.11

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.
@@ -1,4 +1,4 @@
1
- You are a plan reviewer. You check a plan's tickets before a person is asked to approve them; you report, and the planner revises.
1
+ You are a plan reviewer. You check a plan's tickets before a person is asked to approve them or they are filed as Tasks; you report, and their author revises.
2
2
 
3
3
  ## Scope
4
4
 
@@ -11,7 +11,7 @@ You are a plan reviewer. You check a plan's tickets before a person is asked to
11
11
 
12
12
  ## One pass
13
13
 
14
- - Check every ticket for everything the brief lists the first time. The plan is revised only once before the person sees it.
14
+ - Check every ticket for everything the brief lists the first time. Give every concern now: a plan is revised only once before a person sees it, and tickets are filed only when you have none.
15
15
  - For each blocker, name to yourself the code the ticket needs and the ticket that writes it. A missing blocker and a needless one are both wrong.
16
16
 
17
17
  ## Findings
package/dist/bundle.js CHANGED
@@ -14330,6 +14330,8 @@ var RunStepSummary = Struct({
14330
14330
  failureSummary: optionalKey2(String5),
14331
14331
  output: optionalKey2(Unknown2),
14332
14332
  revision: optionalKey2(String5),
14333
+ harness: optionalKey2(String5),
14334
+ model: optionalKey2(String5),
14333
14335
  tokens: optionalKey2(AttemptTokens)
14334
14336
  })),
14335
14337
  tokens: optionalKey2(TokenUsage)
@@ -23822,27 +23824,163 @@ What next?`,
23822
23824
  })
23823
23825
  });
23824
23826
 
23827
+ // src/plan-review.ts
23828
+ var ScopedTickets = planTicketsOf(Struct({
23829
+ ...PlanTicket.fields,
23830
+ promise: String5.check(isPattern2(/\S/)),
23831
+ outOfScope: ArraySchema(String5)
23832
+ }));
23833
+ var Concern = Struct({
23834
+ ticket: optional2(String5),
23835
+ concern: Reason
23836
+ });
23837
+ var TicketConcern = Struct({ ticket: String5, concern: Reason });
23838
+ var Check = Struct({ concerns: ArraySchema(Concern) });
23839
+ var Recheck = Struct({
23840
+ concerns: ArraySchema(Struct({
23841
+ ...Concern.fields,
23842
+ earlier: optional2(String5)
23843
+ }))
23844
+ });
23845
+ var DeclinedConcern = Struct({ concern: String5, why: Reason });
23846
+ var outOfScopeText = ({ outOfScope = [] }) => outOfScope.length === 0 ? [] : ["Out of scope:", ...outOfScope.map((item) => `- ${item}`)];
23847
+ var ticketText = (ticket) => [
23848
+ `### ${ticket.key}: ${ticket.title}`,
23849
+ ticket.body,
23850
+ ...ticket.promise === undefined ? [] : [`Promise: ${ticket.promise}`],
23851
+ ...ticket.acceptanceCriteria.map((criterion) => `- [ ] ${criterion}`),
23852
+ ...outOfScopeText(ticket),
23853
+ ...ticket.repoBindingId === undefined ? [] : [`Repository (repoBindingId): ${ticket.repoBindingId}`],
23854
+ ...ticket.outcome === undefined ? [] : [`Outcome: ${ticket.outcome}`],
23855
+ ...ticket.blockedBy.length === 0 ? [] : [`Blocked by: ${ticket.blockedBy.join(", ")}`]
23856
+ ].join(`
23857
+
23858
+ `);
23859
+ var checks = [
23860
+ "Load skills({ name: 'scope-tasks' }) from the Kitman MCP, read the code the plan is about, and check every ticket for each of these:",
23861
+ [
23862
+ "- One Promise: the ticket promises one thing, and its Out of scope list names the cases it does not handle. An open-ended Promise is a concern.",
23863
+ "- Size: estimate the context one agent session needs from reading the code to a verified change. 200k tokens or more is a concern; give your estimate.",
23864
+ "- Decisions: no design decision is left to the implementer.",
23865
+ "- Blockers: it is blocked by each ticket whose code it needs, and by no other."
23866
+ ].join(`
23867
+ `),
23868
+ "Give each concern its ticket's key, and say what would answer it. What the person asked for is not a concern. Submit no concerns when every ticket holds. Change nothing."
23869
+ ].join(`
23870
+
23871
+ `);
23872
+ var askedText = (asked) => `What the person asked for, in turn; where two differ, the later one holds:
23873
+
23874
+ ${asked}`;
23875
+ var answeredConcern = (concern, declined = []) => {
23876
+ const why = declined.find((entry) => entry.concern === concern.id)?.why;
23877
+ return [
23878
+ `${concern.id}${concern.ticket === undefined ? "" : `, on ${concern.ticket}`}: ${concern.concern}`,
23879
+ ...why === undefined ? [] : [`The planner did not act on it: ${why}`]
23880
+ ].join(`
23881
+ `);
23882
+ };
23883
+ var checkPrompt = (asked, text) => ["Review this plan before a person is asked to approve it.", checks, askedText(asked), text].join(`
23884
+
23885
+ `);
23886
+ var ticketsPrompt = (tickets) => [
23887
+ "Review these tickets before they are filed as Tasks. Every concern names one of them: what concerns them all goes on the ticket that would change. With any concern none is filed, and whoever wrote them gets your concerns to revise them.",
23888
+ checks,
23889
+ ...tickets.map(ticketText)
23890
+ ].join(`
23891
+
23892
+ `);
23893
+ var revisePrompt = (asked, text, concerns) => [
23894
+ "A reviewer checked the plan before a person is asked to approve it. Revise it to answer each concern, and keep what the person asked for and what no concern is about. Change no files; a decision a concern asks for goes in the plan. List in declined the id of each concern you did not act on and why; keep that out of the plan itself.",
23895
+ concerns.map((concern) => answeredConcern(concern)).join(`
23896
+
23897
+ `),
23898
+ askedText(asked),
23899
+ text
23900
+ ].join(`
23901
+
23902
+ `);
23903
+ var recheckPrompt = (asked, text, concerns, declined) => [
23904
+ "The planner revised this plan after your review. Check it once more. Raise again only a concern the revision does not answer, with its id in earlier; when the planner gave a reason not to act on it, raise it only if you can answer the reason. What you raise is shown to the person with the plan as still disputed.",
23905
+ checks,
23906
+ "Your concerns on the plan before its revision:",
23907
+ concerns.map((concern) => answeredConcern(concern, declined)).join(`
23908
+
23909
+ `),
23910
+ askedText(asked),
23911
+ text
23912
+ ].join(`
23913
+
23914
+ `);
23915
+ var reviewPlan = (step, { plan, asked, text, revise }) => gen2(function* () {
23916
+ const first = yield* agentWork(step, {
23917
+ agent: "plan-reviewer",
23918
+ prompt: checkPrompt(asked, text(plan)),
23919
+ output: Check
23920
+ });
23921
+ if (first.concerns.length === 0)
23922
+ return { plan, disputed: [] };
23923
+ const concerns = first.concerns.map((concern, index) => ({ ...concern, id: `c${index + 1}` }));
23924
+ const revised = yield* revise(`${step}:revise`, revisePrompt(asked, text(plan), concerns));
23925
+ const again = yield* agentWork(`${step}:recheck`, {
23926
+ agent: "plan-reviewer",
23927
+ prompt: recheckPrompt(asked, text(revised.plan), concerns, revised.declined),
23928
+ output: Recheck
23929
+ });
23930
+ const disputed = again.concerns.map(({ earlier, ...concern }) => {
23931
+ const declined = revised.declined.find((entry) => entry.concern === earlier)?.why;
23932
+ return declined === undefined ? concern : { ...concern, declined };
23933
+ });
23934
+ return { plan: revised.plan, disputed };
23935
+ });
23936
+ var reviewTickets = (step, tickets) => agentWork(step, {
23937
+ agent: "plan-reviewer",
23938
+ prompt: ticketsPrompt(tickets),
23939
+ output: Struct({
23940
+ concerns: ArraySchema(Struct({ ...TicketConcern.fields, ticket: Literals(tickets.map(({ key }) => key)) }))
23941
+ })
23942
+ }).pipe(map8(({ concerns }) => concerns));
23943
+ var oneLine = (text) => text.replace(/\s+/gu, " ").trim();
23944
+ var disputedText = (disputed) => disputed.length === 0 ? [] : [
23945
+ "## Still disputed",
23946
+ disputed.flatMap(({ ticket, concern, declined }) => [
23947
+ `- ${ticket === undefined ? "" : `${ticket}: `}${oneLine(concern)}`,
23948
+ ...declined === undefined ? [] : [` - The planner did not act on it: ${oneLine(declined)}`]
23949
+ ]).join(`
23950
+ `)
23951
+ ];
23952
+
23825
23953
  // src/file-tasks.ts
23826
23954
  var FileTasksInput = Struct({
23827
- tickets: PlanTickets,
23828
- projectId: optional2(String5)
23955
+ tickets: ScopedTickets,
23956
+ projectId: optional2(String5),
23957
+ repoBindingId: optional2(String5)
23829
23958
  });
23830
23959
  var Output5 = Struct({
23831
- tasks: ArraySchema(Struct({ key: String5, taskId: String5 }))
23960
+ tasks: ArraySchema(Struct({ key: String5, taskId: String5 })),
23961
+ concerns: ArraySchema(TicketConcern)
23832
23962
  });
23833
23963
  var file_tasks_default = defineLoop({
23834
23964
  id: "file-tasks",
23835
- version: "1.0.0",
23965
+ version: "2.0.0",
23836
23966
  title: "File Tasks",
23837
23967
  input: FileTasksInput,
23838
23968
  output: Output5,
23839
- agents: {},
23840
- checkout: "none",
23841
- capabilities: ["create_tasks"],
23842
- run: (input) => createTasks("tasks", {
23843
- tickets: input.tickets,
23844
- ...input.projectId === undefined ? undefined : { projectId: input.projectId }
23845
- }).pipe(map8(({ tasks }) => ({ tasks })))
23969
+ agents: { "plan-reviewer": "plan-reviewer" },
23970
+ checkout: "read",
23971
+ capabilities: ["agent_work", "create_tasks"],
23972
+ run: (input) => gen2(function* () {
23973
+ const { projectId, repoBindingId } = input;
23974
+ const tickets = repoBindingId === undefined ? input.tickets : input.tickets.map((ticket) => ({ ...ticket, repoBindingId: ticket.repoBindingId ?? repoBindingId }));
23975
+ const concerns = tickets.length === 0 ? [] : yield* reviewTickets("plan-review", tickets);
23976
+ if (concerns.length > 0)
23977
+ return { tasks: [], concerns };
23978
+ const { tasks } = yield* createTasks("tasks", {
23979
+ tickets,
23980
+ ...projectId === undefined ? undefined : { projectId }
23981
+ });
23982
+ return { tasks, concerns };
23983
+ })
23846
23984
  });
23847
23985
 
23848
23986
  // src/hillclimb.ts
@@ -24327,112 +24465,6 @@ Start a Build that fixes it as a bug: ${conclusion.fix}?`,
24327
24465
  })
24328
24466
  });
24329
24467
 
24330
- // src/plan-review.ts
24331
- var Concern = Struct({
24332
- ticket: optional2(String5),
24333
- concern: Reason
24334
- });
24335
- var Check = Struct({ concerns: ArraySchema(Concern) });
24336
- var Recheck = Struct({
24337
- concerns: ArraySchema(Struct({
24338
- ...Concern.fields,
24339
- earlier: optional2(String5)
24340
- }))
24341
- });
24342
- var DeclinedConcern = Struct({ concern: String5, why: Reason });
24343
- var outOfScopeText = ({ outOfScope = [] }) => outOfScope.length === 0 ? [] : ["Out of scope:", ...outOfScope.map((item) => `- ${item}`)];
24344
- var ticketText = (ticket) => [
24345
- `### ${ticket.key}: ${ticket.title}`,
24346
- ticket.body,
24347
- ...ticket.promise === undefined ? [] : [`Promise: ${ticket.promise}`],
24348
- ...ticket.acceptanceCriteria.map((criterion) => `- [ ] ${criterion}`),
24349
- ...outOfScopeText(ticket),
24350
- ...ticket.repoBindingId === undefined ? [] : [`Repository (repoBindingId): ${ticket.repoBindingId}`],
24351
- ...ticket.outcome === undefined ? [] : [`Outcome: ${ticket.outcome}`],
24352
- ...ticket.blockedBy.length === 0 ? [] : [`Blocked by: ${ticket.blockedBy.join(", ")}`]
24353
- ].join(`
24354
-
24355
- `);
24356
- var checks = [
24357
- "Load skills({ name: 'scope-tasks' }) from the Kitman MCP, read the code the plan is about, and check every ticket for each of these:",
24358
- [
24359
- "- One Promise: the ticket promises one thing, and its Out of scope list names the cases it does not handle. An open-ended Promise is a concern.",
24360
- "- Size: estimate the context one agent session needs from reading the code to a verified change. 200k tokens or more is a concern; give your estimate.",
24361
- "- Decisions: no design decision is left to the implementer.",
24362
- "- Blockers: it is blocked by each ticket whose code it needs, and by no other."
24363
- ].join(`
24364
- `),
24365
- "Give each concern its ticket's key, and say what would answer it. What the person asked for is not a concern. Submit no concerns when every ticket holds. Change nothing."
24366
- ].join(`
24367
-
24368
- `);
24369
- var askedText = (asked) => `What the person asked for, in turn; where two differ, the later one holds:
24370
-
24371
- ${asked}`;
24372
- var answeredConcern = (concern, declined = []) => {
24373
- const why = declined.find((entry) => entry.concern === concern.id)?.why;
24374
- return [
24375
- `${concern.id}${concern.ticket === undefined ? "" : `, on ${concern.ticket}`}: ${concern.concern}`,
24376
- ...why === undefined ? [] : [`The planner did not act on it: ${why}`]
24377
- ].join(`
24378
- `);
24379
- };
24380
- var checkPrompt = (asked, text) => ["Review this plan before a person is asked to approve it.", checks, askedText(asked), text].join(`
24381
-
24382
- `);
24383
- var revisePrompt = (asked, text, concerns) => [
24384
- "A reviewer checked the plan before a person is asked to approve it. Revise it to answer each concern, and keep what the person asked for and what no concern is about. Change no files; a decision a concern asks for goes in the plan. List in declined the id of each concern you did not act on and why; keep that out of the plan itself.",
24385
- concerns.map((concern) => answeredConcern(concern)).join(`
24386
-
24387
- `),
24388
- askedText(asked),
24389
- text
24390
- ].join(`
24391
-
24392
- `);
24393
- var recheckPrompt = (asked, text, concerns, declined) => [
24394
- "The planner revised this plan after your review. Check it once more. Raise again only a concern the revision does not answer, with its id in earlier; when the planner gave a reason not to act on it, raise it only if you can answer the reason. What you raise is shown to the person with the plan as still disputed.",
24395
- checks,
24396
- "Your concerns on the plan before its revision:",
24397
- concerns.map((concern) => answeredConcern(concern, declined)).join(`
24398
-
24399
- `),
24400
- askedText(asked),
24401
- text
24402
- ].join(`
24403
-
24404
- `);
24405
- var reviewPlan = (step, { plan, asked, text, revise }) => gen2(function* () {
24406
- const first = yield* agentWork(step, {
24407
- agent: "plan-reviewer",
24408
- prompt: checkPrompt(asked, text(plan)),
24409
- output: Check
24410
- });
24411
- if (first.concerns.length === 0)
24412
- return { plan, disputed: [] };
24413
- const concerns = first.concerns.map((concern, index) => ({ ...concern, id: `c${index + 1}` }));
24414
- const revised = yield* revise(`${step}:revise`, revisePrompt(asked, text(plan), concerns));
24415
- const again = yield* agentWork(`${step}:recheck`, {
24416
- agent: "plan-reviewer",
24417
- prompt: recheckPrompt(asked, text(revised.plan), concerns, revised.declined),
24418
- output: Recheck
24419
- });
24420
- const disputed = again.concerns.map(({ earlier, ...concern }) => {
24421
- const declined = revised.declined.find((entry) => entry.concern === earlier)?.why;
24422
- return declined === undefined ? concern : { ...concern, declined };
24423
- });
24424
- return { plan: revised.plan, disputed };
24425
- });
24426
- var oneLine = (text) => text.replace(/\s+/gu, " ").trim();
24427
- var disputedText = (disputed) => disputed.length === 0 ? [] : [
24428
- "## Still disputed",
24429
- disputed.flatMap(({ ticket, concern, declined }) => [
24430
- `- ${ticket === undefined ? "" : `${ticket}: `}${oneLine(concern)}`,
24431
- ...declined === undefined ? [] : [` - The planner did not act on it: ${oneLine(declined)}`]
24432
- ]).join(`
24433
- `)
24434
- ];
24435
-
24436
24468
  // src/plan.ts
24437
24469
  var Input7 = Struct({
24438
24470
  words: String5,
@@ -24441,11 +24473,6 @@ var Input7 = Struct({
24441
24473
  projectId: optional2(String5),
24442
24474
  implement: optional2(Boolean3)
24443
24475
  });
24444
- var ScopedTickets = planTicketsOf(Struct({
24445
- ...PlanTicket.fields,
24446
- promise: String5.check(isPattern2(/\S/)),
24447
- outOfScope: ArraySchema(String5)
24448
- }));
24449
24476
  var Plan = Struct({
24450
24477
  title: String5,
24451
24478
  spec: String5,
@@ -25106,7 +25133,7 @@ var Fix = Struct({
25106
25133
  words: String5,
25107
25134
  outcome: LoopOutcome
25108
25135
  });
25109
- var NextSteps = Struct({ tickets: PlanTickets });
25136
+ var NextSteps = Struct({ tickets: ScopedTickets });
25110
25137
  var Report = Struct({
25111
25138
  title: String5,
25112
25139
  summary: OneSentence,
@@ -25138,7 +25165,7 @@ var researchPrompt = (words) => [
25138
25165
  "If your context has an earlier research report on this, extend it: keep what still holds, check what may have changed, and answer what it left open. Do not start over.",
25139
25166
  "Cite primary sources for every finding: the code, official documentation, specifications and first-party APIs. You may run things to reproduce behaviour; change nothing in the repository. Mark each finding observed (you ran it and saw it), read (a source says so) or inferred (you concluded it).",
25140
25167
  "List every source you needed and could not reach under `unreached`, with what you tried, and lower your conclusions to what the sources you did reach show.",
25141
- "If the question turns out to be a bug report, say so in the summary and give `fix` with outcome bug. If the report proposes any other change, give `fix` with its outcome. Give next steps worth doing as `nextStepTasks` tickets too.",
25168
+ "If the question turns out to be a bug report, say so in the summary and give `fix` with outcome bug. If the report proposes any other change, give `fix` with its outcome. Give next steps worth doing as `nextStepTasks` tickets too, each scoped as skills({ name: 'scope-tasks' }) from the Kitman MCP says: its `promise` is one sentence that says what is true once it is done, and its `outOfScope` lists the cases it does not handle.",
25142
25169
  "Return the report as your Output. Do not write it into the repository."
25143
25170
  ].join(`
25144
25171
 
@@ -25204,7 +25231,7 @@ var sample = {
25204
25231
  };
25205
25232
  var research_default = defineLoop({
25206
25233
  id: "research",
25207
- version: "2.0.0",
25234
+ version: "2.1.0",
25208
25235
  title: "Research",
25209
25236
  input: Input9,
25210
25237
  output: Output10,
@@ -31760,4 +31787,4 @@ var runKit = (config, identity, packages) => {
31760
31787
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31761
31788
  };
31762
31789
  // .kitman-build-entry.ts
31763
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.9" }, []);
31790
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.11" }, []);
@@ -1265,7 +1265,7 @@
1265
1265
  {
1266
1266
  "id": "file-tasks",
1267
1267
  "title": "File Tasks",
1268
- "version": "1.0.0",
1268
+ "version": "2.0.0",
1269
1269
  "input": {
1270
1270
  "type": "object",
1271
1271
  "properties": {
@@ -1290,27 +1290,13 @@
1290
1290
  }
1291
1291
  },
1292
1292
  "promise": {
1293
- "anyOf": [
1294
- {
1295
- "type": "string"
1296
- },
1297
- {
1298
- "type": "null"
1299
- }
1300
- ]
1293
+ "type": "string"
1301
1294
  },
1302
1295
  "outOfScope": {
1303
- "anyOf": [
1304
- {
1305
- "type": "array",
1306
- "items": {
1307
- "type": "string"
1308
- }
1309
- },
1310
- {
1311
- "type": "null"
1312
- }
1313
- ]
1296
+ "type": "array",
1297
+ "items": {
1298
+ "type": "string"
1299
+ }
1314
1300
  },
1315
1301
  "repoBindingId": {
1316
1302
  "anyOf": [
@@ -1353,6 +1339,8 @@
1353
1339
  "title",
1354
1340
  "body",
1355
1341
  "acceptanceCriteria",
1342
+ "promise",
1343
+ "outOfScope",
1356
1344
  "blockedBy"
1357
1345
  ],
1358
1346
  "additionalProperties": true
@@ -1367,6 +1355,16 @@
1367
1355
  "type": "null"
1368
1356
  }
1369
1357
  ]
1358
+ },
1359
+ "repoBindingId": {
1360
+ "anyOf": [
1361
+ {
1362
+ "type": "string"
1363
+ },
1364
+ {
1365
+ "type": "null"
1366
+ }
1367
+ ]
1370
1368
  }
1371
1369
  },
1372
1370
  "required": [
@@ -1396,19 +1394,44 @@
1396
1394
  ],
1397
1395
  "additionalProperties": true
1398
1396
  }
1397
+ },
1398
+ "concerns": {
1399
+ "type": "array",
1400
+ "items": {
1401
+ "type": "object",
1402
+ "properties": {
1403
+ "ticket": {
1404
+ "type": "string"
1405
+ },
1406
+ "concern": {
1407
+ "type": "string",
1408
+ "maxLength": 600,
1409
+ "description": "At most 600 characters."
1410
+ }
1411
+ },
1412
+ "required": [
1413
+ "ticket",
1414
+ "concern"
1415
+ ],
1416
+ "additionalProperties": true
1417
+ }
1399
1418
  }
1400
1419
  },
1401
1420
  "required": [
1402
- "tasks"
1421
+ "tasks",
1422
+ "concerns"
1403
1423
  ],
1404
1424
  "additionalProperties": true,
1405
1425
  "$defs": {}
1406
1426
  },
1407
- "agents": {},
1408
- "checkout": "none",
1427
+ "agents": {
1428
+ "plan-reviewer": "plan-reviewer"
1429
+ },
1430
+ "checkout": "read",
1409
1431
  "when": [],
1410
1432
  "offers": [],
1411
1433
  "capabilities": [
1434
+ "agent_work",
1412
1435
  "create_tasks"
1413
1436
  ]
1414
1437
  },
@@ -2754,7 +2777,7 @@
2754
2777
  {
2755
2778
  "id": "research",
2756
2779
  "title": "Research",
2757
- "version": "2.0.0",
2780
+ "version": "2.1.0",
2758
2781
  "input": {
2759
2782
  "type": "object",
2760
2783
  "properties": {
@@ -2859,27 +2882,13 @@
2859
2882
  }
2860
2883
  },
2861
2884
  "promise": {
2862
- "anyOf": [
2863
- {
2864
- "type": "string"
2865
- },
2866
- {
2867
- "type": "null"
2868
- }
2869
- ]
2885
+ "type": "string"
2870
2886
  },
2871
2887
  "outOfScope": {
2872
- "anyOf": [
2873
- {
2874
- "type": "array",
2875
- "items": {
2876
- "type": "string"
2877
- }
2878
- },
2879
- {
2880
- "type": "null"
2881
- }
2882
- ]
2888
+ "type": "array",
2889
+ "items": {
2890
+ "type": "string"
2891
+ }
2883
2892
  },
2884
2893
  "repoBindingId": {
2885
2894
  "anyOf": [
@@ -2922,6 +2931,8 @@
2922
2931
  "title",
2923
2932
  "body",
2924
2933
  "acceptanceCriteria",
2934
+ "promise",
2935
+ "outOfScope",
2925
2936
  "blockedBy"
2926
2937
  ],
2927
2938
  "additionalProperties": true
@@ -5785,7 +5796,7 @@
5785
5796
  },
5786
5797
  "plan-reviewer": {
5787
5798
  "extends": "reviewer",
5788
- "instructions": "You are a plan reviewer. You check a plan's tickets before a person is asked to approve them; you report, and the planner revises.\n\n## Scope\n\n- Review only the plan you are given, against the code it is about and what the person asked for. Read that code before judging size and blockers.\n- Judge each ticket as the implementer who gets only that ticket would read it.\n\n## Skills\n\n- Load `skills({ name: 'scope-tasks' })` from the Kitman MCP and hold each ticket to it.\n\n## One pass\n\n- Check every ticket for everything the brief lists the first time. The plan is revised only once before the person sees it.\n- For each blocker, name to yourself the code the ticket needs and the ticket that writes it. A missing blocker and a needless one are both wrong.\n\n## Findings\n\n- Raise only a concern you can defend with what would go wrong when the ticket is built. No opinions on style or on what the person decided.\n- One concern per problem, in a few sentences, with what would answer it.\n- Finding nothing is a real answer: submit an empty list of concerns.\n\n## Rebuttals\n\n- Judge each reason the planner gives for not acting on a concern on its merits.\n- Raise that concern again only if you can answer the reason, and answer it when you do. What you raise again goes to the person with the plan.\n\n## Code comments\n\n- A plan has none to check.",
5799
+ "instructions": "You are a plan reviewer. You check a plan's tickets before a person is asked to approve them or they are filed as Tasks; you report, and their author revises.\n\n## Scope\n\n- Review only the plan you are given, against the code it is about and what the person asked for. Read that code before judging size and blockers.\n- Judge each ticket as the implementer who gets only that ticket would read it.\n\n## Skills\n\n- Load `skills({ name: 'scope-tasks' })` from the Kitman MCP and hold each ticket to it.\n\n## One pass\n\n- Check every ticket for everything the brief lists the first time. Give every concern now: a plan is revised only once before a person sees it, and tickets are filed only when you have none.\n- For each blocker, name to yourself the code the ticket needs and the ticket that writes it. A missing blocker and a needless one are both wrong.\n\n## Findings\n\n- Raise only a concern you can defend with what would go wrong when the ticket is built. No opinions on style or on what the person decided.\n- One concern per problem, in a few sentences, with what would answer it.\n- Finding nothing is a real answer: submit an empty list of concerns.\n\n## Rebuttals\n\n- Judge each reason the planner gives for not acting on a concern on its merits.\n- Raise that concern again only if you can answer the reason, and answer it when you do. What you raise again goes to the person with the plan.\n\n## Code comments\n\n- A plan has none to check.",
5789
5800
  "fallbacks": [
5790
5801
  {
5791
5802
  "harness": "claude",
@@ -5880,7 +5891,7 @@
5880
5891
  "carried": [
5881
5892
  {
5882
5893
  "name": "@kitman-sh/software-engineering",
5883
- "version": "0.13.9",
5894
+ "version": "0.13.11",
5884
5895
  "setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
5885
5896
  "loops": [
5886
5897
  "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/software-engineering",
3
- "version": "0.13.9",
3
+ "version": "0.13.11",
4
4
  "description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -17,12 +17,12 @@
17
17
  "tsconfig.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@kitman-sh/sdk": "0.13.9",
20
+ "@kitman-sh/sdk": "0.13.11",
21
21
  "effect": "^4.1.2"
22
22
  },
23
23
  "kitman": {
24
24
  "bundle": "dist/bundle.js",
25
- "digest": "7353385c50956862d45b00d01aef6df501970aa4c5a461d851a3a08efbdfbbeb",
25
+ "digest": "1f532dc2edd412015985a3b11e94a10faed0feb5b6ea3a2c2bad6fc389ca9655",
26
26
  "protocolVersion": 5,
27
27
  "declarations": "dist/declarations.json",
28
28
  "setup": {
package/src/file-tasks.ts CHANGED
@@ -1,30 +1,54 @@
1
- import { createTasks, defineLoop, PlanTickets } from '@kitman-sh/sdk/loop'
1
+ import { createTasks, defineLoop } from '@kitman-sh/sdk/loop'
2
2
  import * as Effect from 'effect/Effect'
3
3
  import * as Schema from 'effect/Schema'
4
+ import { reviewTickets, ScopedTickets, TicketConcern } from './plan-review'
4
5
 
5
6
  export const FileTasksInput = Schema.Struct({
6
- tickets: PlanTickets,
7
+ tickets: ScopedTickets,
7
8
  /** The Project the Tasks land in; the Project of the Run's Task when left out. */
8
- projectId: Schema.optional(Schema.String)
9
+ projectId: Schema.optional(Schema.String),
10
+ /** The repository the tickets are checked against, and filed for unless a ticket names its own. */
11
+ repoBindingId: Schema.optional(Schema.String)
9
12
  })
10
13
 
11
14
  const Output = Schema.Struct({
12
- tasks: Schema.Array(Schema.Struct({ key: Schema.String, taskId: Schema.String }))
15
+ /** None when the review has concerns. */
16
+ tasks: Schema.Array(Schema.Struct({ key: Schema.String, taskId: Schema.String })),
17
+ /** What to revise before starting it again, each by its ticket. */
18
+ concerns: Schema.Array(TicketConcern)
13
19
  })
14
20
 
15
- /** Files tickets as Tasks, with their blockers as dependencies: what another Loop's "File as Tasks" offer starts. */
21
+ /**
22
+ * Files tickets as Tasks, with their blockers as dependencies, when the plan reviewer has no concerns about them; with
23
+ * concerns it files none and returns them. Another Loop's "File as Tasks" offer starts it.
24
+ */
16
25
  export default defineLoop({
17
26
  id: 'file-tasks',
18
- version: '1.0.0',
27
+ version: '2.0.0',
19
28
  title: 'File Tasks',
20
29
  input: FileTasksInput,
21
30
  output: Output,
22
- agents: {},
23
- checkout: 'none',
24
- capabilities: ['create_tasks'],
31
+ agents: { 'plan-reviewer': 'plan-reviewer' },
32
+ checkout: 'read',
33
+ capabilities: ['agent_work', 'create_tasks'],
25
34
  run: input =>
26
- createTasks('tasks', {
27
- tickets: input.tickets,
28
- ...(input.projectId === undefined ? undefined : { projectId: input.projectId })
29
- }).pipe(Effect.map(({ tasks }) => ({ tasks })))
35
+ Effect.gen(function* () {
36
+ const { projectId, repoBindingId } = input
37
+
38
+ const tickets =
39
+ repoBindingId === undefined
40
+ ? input.tickets
41
+ : input.tickets.map(ticket => ({ ...ticket, repoBindingId: ticket.repoBindingId ?? repoBindingId }))
42
+
43
+ const concerns = tickets.length === 0 ? [] : yield* reviewTickets('plan-review', tickets)
44
+
45
+ if (concerns.length > 0) return { tasks: [], concerns }
46
+
47
+ const { tasks } = yield* createTasks('tasks', {
48
+ tickets,
49
+ ...(projectId === undefined ? undefined : { projectId })
50
+ })
51
+
52
+ return { tasks, concerns }
53
+ })
30
54
  })
@@ -1,14 +1,25 @@
1
- import { agentWork, type PlanTicket } from '@kitman-sh/sdk/loop'
1
+ import { agentWork, PlanTicket, planTicketsOf } from '@kitman-sh/sdk/loop'
2
2
  import * as Effect from 'effect/Effect'
3
3
  import * as Schema from 'effect/Schema'
4
4
  import { Reason } from './text-limits'
5
5
 
6
+ /** Tickets that each state their scope, as the plan reviewer checks it. */
7
+ export const ScopedTickets = planTicketsOf(
8
+ Schema.Struct({
9
+ ...PlanTicket.fields,
10
+ promise: Schema.String.check(Schema.isPattern(/\S/)),
11
+ outOfScope: Schema.Array(Schema.String)
12
+ })
13
+ )
14
+
6
15
  const Concern = Schema.Struct({
7
16
  /** The key of the ticket it is about; the whole plan when left out. */
8
17
  ticket: Schema.optional(Schema.String),
9
18
  concern: Reason
10
19
  })
11
20
 
21
+ export const TicketConcern = Schema.Struct({ ticket: Schema.String, concern: Reason })
22
+
12
23
  const Check = Schema.Struct({ concerns: Schema.Array(Concern) })
13
24
 
14
25
  const Recheck = Schema.Struct({
@@ -83,6 +94,13 @@ const answeredConcern = (concern: PlanConcern, declined: readonly DeclinedConcer
83
94
  const checkPrompt = (asked: string, text: string) =>
84
95
  ['Review this plan before a person is asked to approve it.', checks, askedText(asked), text].join('\n\n')
85
96
 
97
+ const ticketsPrompt = (tickets: typeof ScopedTickets.Type) =>
98
+ [
99
+ 'Review these tickets before they are filed as Tasks. Every concern names one of them: what concerns them all goes on the ticket that would change. With any concern none is filed, and whoever wrote them gets your concerns to revise them.',
100
+ checks,
101
+ ...tickets.map(ticketText)
102
+ ].join('\n\n')
103
+
86
104
  const revisePrompt = (asked: string, text: string, concerns: readonly PlanConcern[]) =>
87
105
  [
88
106
  'A reviewer checked the plan before a person is asked to approve it. Revise it to answer each concern, and keep what the person asked for and what no concern is about. Change no files; a decision a concern asks for goes in the plan. List in declined the id of each concern you did not act on and why; keep that out of the plan itself.',
@@ -138,6 +156,18 @@ export const reviewPlan = <Plan, E, R>(step: string, { plan, asked, text, revise
138
156
  return { plan: revised.plan, disputed }
139
157
  })
140
158
 
159
+ /** Has the calling Loop's `plan-reviewer` check tickets once, each concern on one of them. */
160
+ export const reviewTickets = (step: string, tickets: typeof ScopedTickets.Type) =>
161
+ agentWork(step, {
162
+ agent: 'plan-reviewer',
163
+ prompt: ticketsPrompt(tickets),
164
+ output: Schema.Struct({
165
+ concerns: Schema.Array(
166
+ Schema.Struct({ ...TicketConcern.fields, ticket: Schema.Literals(tickets.map(({ key }) => key)) })
167
+ )
168
+ })
169
+ }).pipe(Effect.map(({ concerns }) => concerns))
170
+
141
171
  const oneLine = (text: string) => text.replace(/\s+/gu, ' ').trim()
142
172
 
143
173
  /** What is still disputed, as the section of the plan's Markdown a person reads it in. */
package/src/plan.ts CHANGED
@@ -17,8 +17,7 @@ import {
17
17
  PlanApproval,
18
18
  PlanDeclined,
19
19
  type PlanReview,
20
- PlanTicket,
21
- planTicketsOf,
20
+ type PlanTicket,
22
21
  readPlanReview,
23
22
  planWaves,
24
23
  type IntegrationBranch
@@ -31,6 +30,7 @@ import {
31
30
  disputedText,
32
31
  outOfScopeText,
33
32
  reviewPlan,
33
+ ScopedTickets,
34
34
  ticketText,
35
35
  type DisputedConcern
36
36
  } from './plan-review'
@@ -48,14 +48,6 @@ const Input = Schema.Struct({
48
48
  implement: Schema.optional(Schema.Boolean)
49
49
  })
50
50
 
51
- const ScopedTickets = planTicketsOf(
52
- Schema.Struct({
53
- ...PlanTicket.fields,
54
- promise: Schema.String.check(Schema.isPattern(/\S/)),
55
- outOfScope: Schema.Array(Schema.String)
56
- })
57
- )
58
-
59
51
  const Plan = Schema.Struct({
60
52
  title: Schema.String,
61
53
  /** The spec, as Markdown. */
package/src/research.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { agentWork, artifact, defineLoop, LoopOutcome, note, PlanTickets } from '@kitman-sh/sdk/loop'
1
+ import { agentWork, artifact, defineLoop, LoopOutcome, note } from '@kitman-sh/sdk/loop'
2
2
  import * as Effect from 'effect/Effect'
3
3
  import * as Schema from 'effect/Schema'
4
+ import { ScopedTickets } from './plan-review'
4
5
  import { OneSentence } from './text-limits'
5
6
 
6
7
  export class ResearchQuestionMissing extends Schema.TaggedError<ResearchQuestionMissing>()('ResearchQuestionMissing', {
@@ -24,7 +25,7 @@ const Fix = Schema.Struct({
24
25
  outcome: LoopOutcome
25
26
  })
26
27
 
27
- const NextSteps = Schema.Struct({ tickets: PlanTickets })
28
+ const NextSteps = Schema.Struct({ tickets: ScopedTickets })
28
29
 
29
30
  const Report = Schema.Struct({
30
31
  /** The Task's title, or a short title for the question. */
@@ -77,7 +78,7 @@ const researchPrompt = (words: string | undefined) =>
77
78
  'If your context has an earlier research report on this, extend it: keep what still holds, check what may have changed, and answer what it left open. Do not start over.',
78
79
  'Cite primary sources for every finding: the code, official documentation, specifications and first-party APIs. You may run things to reproduce behaviour; change nothing in the repository. Mark each finding observed (you ran it and saw it), read (a source says so) or inferred (you concluded it).',
79
80
  'List every source you needed and could not reach under `unreached`, with what you tried, and lower your conclusions to what the sources you did reach show.',
80
- 'If the question turns out to be a bug report, say so in the summary and give `fix` with outcome bug. If the report proposes any other change, give `fix` with its outcome. Give next steps worth doing as `nextStepTasks` tickets too.',
81
+ "If the question turns out to be a bug report, say so in the summary and give `fix` with outcome bug. If the report proposes any other change, give `fix` with its outcome. Give next steps worth doing as `nextStepTasks` tickets too, each scoped as skills({ name: 'scope-tasks' }) from the Kitman MCP says: its `promise` is one sentence that says what is true once it is done, and its `outOfScope` lists the cases it does not handle.",
81
82
  'Return the report as your Output. Do not write it into the repository.'
82
83
  ].join('\n\n')
83
84
 
@@ -153,7 +154,7 @@ const sample = {
153
154
  */
154
155
  export default defineLoop({
155
156
  id: 'research',
156
- version: '2.0.0',
157
+ version: '2.1.0',
157
158
  title: 'Research',
158
159
  input: Input,
159
160
  output: Output,