@kitman-sh/software-engineering 0.13.9 → 0.13.10
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/agents/plan-reviewer.md +2 -2
- package/dist/bundle.js +151 -126
- package/dist/declarations.json +56 -45
- package/package.json +3 -3
- package/src/file-tasks.ts +37 -13
- package/src/plan-review.ts +31 -1
- package/src/plan.ts +2 -10
- package/src/research.ts +5 -4
package/agents/plan-reviewer.md
CHANGED
|
@@ -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
|
|
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.
|
|
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
|
@@ -23822,27 +23822,163 @@ What next?`,
|
|
|
23822
23822
|
})
|
|
23823
23823
|
});
|
|
23824
23824
|
|
|
23825
|
+
// src/plan-review.ts
|
|
23826
|
+
var ScopedTickets = planTicketsOf(Struct({
|
|
23827
|
+
...PlanTicket.fields,
|
|
23828
|
+
promise: String5.check(isPattern2(/\S/)),
|
|
23829
|
+
outOfScope: ArraySchema(String5)
|
|
23830
|
+
}));
|
|
23831
|
+
var Concern = Struct({
|
|
23832
|
+
ticket: optional2(String5),
|
|
23833
|
+
concern: Reason
|
|
23834
|
+
});
|
|
23835
|
+
var TicketConcern = Struct({ ticket: String5, concern: Reason });
|
|
23836
|
+
var Check = Struct({ concerns: ArraySchema(Concern) });
|
|
23837
|
+
var Recheck = Struct({
|
|
23838
|
+
concerns: ArraySchema(Struct({
|
|
23839
|
+
...Concern.fields,
|
|
23840
|
+
earlier: optional2(String5)
|
|
23841
|
+
}))
|
|
23842
|
+
});
|
|
23843
|
+
var DeclinedConcern = Struct({ concern: String5, why: Reason });
|
|
23844
|
+
var outOfScopeText = ({ outOfScope = [] }) => outOfScope.length === 0 ? [] : ["Out of scope:", ...outOfScope.map((item) => `- ${item}`)];
|
|
23845
|
+
var ticketText = (ticket) => [
|
|
23846
|
+
`### ${ticket.key}: ${ticket.title}`,
|
|
23847
|
+
ticket.body,
|
|
23848
|
+
...ticket.promise === undefined ? [] : [`Promise: ${ticket.promise}`],
|
|
23849
|
+
...ticket.acceptanceCriteria.map((criterion) => `- [ ] ${criterion}`),
|
|
23850
|
+
...outOfScopeText(ticket),
|
|
23851
|
+
...ticket.repoBindingId === undefined ? [] : [`Repository (repoBindingId): ${ticket.repoBindingId}`],
|
|
23852
|
+
...ticket.outcome === undefined ? [] : [`Outcome: ${ticket.outcome}`],
|
|
23853
|
+
...ticket.blockedBy.length === 0 ? [] : [`Blocked by: ${ticket.blockedBy.join(", ")}`]
|
|
23854
|
+
].join(`
|
|
23855
|
+
|
|
23856
|
+
`);
|
|
23857
|
+
var checks = [
|
|
23858
|
+
"Load skills({ name: 'scope-tasks' }) from the Kitman MCP, read the code the plan is about, and check every ticket for each of these:",
|
|
23859
|
+
[
|
|
23860
|
+
"- 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.",
|
|
23861
|
+
"- 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.",
|
|
23862
|
+
"- Decisions: no design decision is left to the implementer.",
|
|
23863
|
+
"- Blockers: it is blocked by each ticket whose code it needs, and by no other."
|
|
23864
|
+
].join(`
|
|
23865
|
+
`),
|
|
23866
|
+
"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."
|
|
23867
|
+
].join(`
|
|
23868
|
+
|
|
23869
|
+
`);
|
|
23870
|
+
var askedText = (asked) => `What the person asked for, in turn; where two differ, the later one holds:
|
|
23871
|
+
|
|
23872
|
+
${asked}`;
|
|
23873
|
+
var answeredConcern = (concern, declined = []) => {
|
|
23874
|
+
const why = declined.find((entry) => entry.concern === concern.id)?.why;
|
|
23875
|
+
return [
|
|
23876
|
+
`${concern.id}${concern.ticket === undefined ? "" : `, on ${concern.ticket}`}: ${concern.concern}`,
|
|
23877
|
+
...why === undefined ? [] : [`The planner did not act on it: ${why}`]
|
|
23878
|
+
].join(`
|
|
23879
|
+
`);
|
|
23880
|
+
};
|
|
23881
|
+
var checkPrompt = (asked, text) => ["Review this plan before a person is asked to approve it.", checks, askedText(asked), text].join(`
|
|
23882
|
+
|
|
23883
|
+
`);
|
|
23884
|
+
var ticketsPrompt = (tickets) => [
|
|
23885
|
+
"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.",
|
|
23886
|
+
checks,
|
|
23887
|
+
...tickets.map(ticketText)
|
|
23888
|
+
].join(`
|
|
23889
|
+
|
|
23890
|
+
`);
|
|
23891
|
+
var revisePrompt = (asked, text, concerns) => [
|
|
23892
|
+
"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.",
|
|
23893
|
+
concerns.map((concern) => answeredConcern(concern)).join(`
|
|
23894
|
+
|
|
23895
|
+
`),
|
|
23896
|
+
askedText(asked),
|
|
23897
|
+
text
|
|
23898
|
+
].join(`
|
|
23899
|
+
|
|
23900
|
+
`);
|
|
23901
|
+
var recheckPrompt = (asked, text, concerns, declined) => [
|
|
23902
|
+
"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.",
|
|
23903
|
+
checks,
|
|
23904
|
+
"Your concerns on the plan before its revision:",
|
|
23905
|
+
concerns.map((concern) => answeredConcern(concern, declined)).join(`
|
|
23906
|
+
|
|
23907
|
+
`),
|
|
23908
|
+
askedText(asked),
|
|
23909
|
+
text
|
|
23910
|
+
].join(`
|
|
23911
|
+
|
|
23912
|
+
`);
|
|
23913
|
+
var reviewPlan = (step, { plan, asked, text, revise }) => gen2(function* () {
|
|
23914
|
+
const first = yield* agentWork(step, {
|
|
23915
|
+
agent: "plan-reviewer",
|
|
23916
|
+
prompt: checkPrompt(asked, text(plan)),
|
|
23917
|
+
output: Check
|
|
23918
|
+
});
|
|
23919
|
+
if (first.concerns.length === 0)
|
|
23920
|
+
return { plan, disputed: [] };
|
|
23921
|
+
const concerns = first.concerns.map((concern, index) => ({ ...concern, id: `c${index + 1}` }));
|
|
23922
|
+
const revised = yield* revise(`${step}:revise`, revisePrompt(asked, text(plan), concerns));
|
|
23923
|
+
const again = yield* agentWork(`${step}:recheck`, {
|
|
23924
|
+
agent: "plan-reviewer",
|
|
23925
|
+
prompt: recheckPrompt(asked, text(revised.plan), concerns, revised.declined),
|
|
23926
|
+
output: Recheck
|
|
23927
|
+
});
|
|
23928
|
+
const disputed = again.concerns.map(({ earlier, ...concern }) => {
|
|
23929
|
+
const declined = revised.declined.find((entry) => entry.concern === earlier)?.why;
|
|
23930
|
+
return declined === undefined ? concern : { ...concern, declined };
|
|
23931
|
+
});
|
|
23932
|
+
return { plan: revised.plan, disputed };
|
|
23933
|
+
});
|
|
23934
|
+
var reviewTickets = (step, tickets) => agentWork(step, {
|
|
23935
|
+
agent: "plan-reviewer",
|
|
23936
|
+
prompt: ticketsPrompt(tickets),
|
|
23937
|
+
output: Struct({
|
|
23938
|
+
concerns: ArraySchema(Struct({ ...TicketConcern.fields, ticket: Literals(tickets.map(({ key }) => key)) }))
|
|
23939
|
+
})
|
|
23940
|
+
}).pipe(map8(({ concerns }) => concerns));
|
|
23941
|
+
var oneLine = (text) => text.replace(/\s+/gu, " ").trim();
|
|
23942
|
+
var disputedText = (disputed) => disputed.length === 0 ? [] : [
|
|
23943
|
+
"## Still disputed",
|
|
23944
|
+
disputed.flatMap(({ ticket, concern, declined }) => [
|
|
23945
|
+
`- ${ticket === undefined ? "" : `${ticket}: `}${oneLine(concern)}`,
|
|
23946
|
+
...declined === undefined ? [] : [` - The planner did not act on it: ${oneLine(declined)}`]
|
|
23947
|
+
]).join(`
|
|
23948
|
+
`)
|
|
23949
|
+
];
|
|
23950
|
+
|
|
23825
23951
|
// src/file-tasks.ts
|
|
23826
23952
|
var FileTasksInput = Struct({
|
|
23827
|
-
tickets:
|
|
23828
|
-
projectId: optional2(String5)
|
|
23953
|
+
tickets: ScopedTickets,
|
|
23954
|
+
projectId: optional2(String5),
|
|
23955
|
+
repoBindingId: optional2(String5)
|
|
23829
23956
|
});
|
|
23830
23957
|
var Output5 = Struct({
|
|
23831
|
-
tasks: ArraySchema(Struct({ key: String5, taskId: String5 }))
|
|
23958
|
+
tasks: ArraySchema(Struct({ key: String5, taskId: String5 })),
|
|
23959
|
+
concerns: ArraySchema(TicketConcern)
|
|
23832
23960
|
});
|
|
23833
23961
|
var file_tasks_default = defineLoop({
|
|
23834
23962
|
id: "file-tasks",
|
|
23835
|
-
version: "
|
|
23963
|
+
version: "2.0.0",
|
|
23836
23964
|
title: "File Tasks",
|
|
23837
23965
|
input: FileTasksInput,
|
|
23838
23966
|
output: Output5,
|
|
23839
|
-
agents: {},
|
|
23840
|
-
checkout: "
|
|
23841
|
-
capabilities: ["create_tasks"],
|
|
23842
|
-
run: (input) =>
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23967
|
+
agents: { "plan-reviewer": "plan-reviewer" },
|
|
23968
|
+
checkout: "read",
|
|
23969
|
+
capabilities: ["agent_work", "create_tasks"],
|
|
23970
|
+
run: (input) => gen2(function* () {
|
|
23971
|
+
const { projectId, repoBindingId } = input;
|
|
23972
|
+
const tickets = repoBindingId === undefined ? input.tickets : input.tickets.map((ticket) => ({ ...ticket, repoBindingId: ticket.repoBindingId ?? repoBindingId }));
|
|
23973
|
+
const concerns = tickets.length === 0 ? [] : yield* reviewTickets("plan-review", tickets);
|
|
23974
|
+
if (concerns.length > 0)
|
|
23975
|
+
return { tasks: [], concerns };
|
|
23976
|
+
const { tasks } = yield* createTasks("tasks", {
|
|
23977
|
+
tickets,
|
|
23978
|
+
...projectId === undefined ? undefined : { projectId }
|
|
23979
|
+
});
|
|
23980
|
+
return { tasks, concerns };
|
|
23981
|
+
})
|
|
23846
23982
|
});
|
|
23847
23983
|
|
|
23848
23984
|
// src/hillclimb.ts
|
|
@@ -24327,112 +24463,6 @@ Start a Build that fixes it as a bug: ${conclusion.fix}?`,
|
|
|
24327
24463
|
})
|
|
24328
24464
|
});
|
|
24329
24465
|
|
|
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
24466
|
// src/plan.ts
|
|
24437
24467
|
var Input7 = Struct({
|
|
24438
24468
|
words: String5,
|
|
@@ -24441,11 +24471,6 @@ var Input7 = Struct({
|
|
|
24441
24471
|
projectId: optional2(String5),
|
|
24442
24472
|
implement: optional2(Boolean3)
|
|
24443
24473
|
});
|
|
24444
|
-
var ScopedTickets = planTicketsOf(Struct({
|
|
24445
|
-
...PlanTicket.fields,
|
|
24446
|
-
promise: String5.check(isPattern2(/\S/)),
|
|
24447
|
-
outOfScope: ArraySchema(String5)
|
|
24448
|
-
}));
|
|
24449
24474
|
var Plan = Struct({
|
|
24450
24475
|
title: String5,
|
|
24451
24476
|
spec: String5,
|
|
@@ -25106,7 +25131,7 @@ var Fix = Struct({
|
|
|
25106
25131
|
words: String5,
|
|
25107
25132
|
outcome: LoopOutcome
|
|
25108
25133
|
});
|
|
25109
|
-
var NextSteps = Struct({ tickets:
|
|
25134
|
+
var NextSteps = Struct({ tickets: ScopedTickets });
|
|
25110
25135
|
var Report = Struct({
|
|
25111
25136
|
title: String5,
|
|
25112
25137
|
summary: OneSentence,
|
|
@@ -25138,7 +25163,7 @@ var researchPrompt = (words) => [
|
|
|
25138
25163
|
"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
25164
|
"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
25165
|
"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.",
|
|
25166
|
+
"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
25167
|
"Return the report as your Output. Do not write it into the repository."
|
|
25143
25168
|
].join(`
|
|
25144
25169
|
|
|
@@ -25204,7 +25229,7 @@ var sample = {
|
|
|
25204
25229
|
};
|
|
25205
25230
|
var research_default = defineLoop({
|
|
25206
25231
|
id: "research",
|
|
25207
|
-
version: "2.
|
|
25232
|
+
version: "2.1.0",
|
|
25208
25233
|
title: "Research",
|
|
25209
25234
|
input: Input9,
|
|
25210
25235
|
output: Output10,
|
|
@@ -31760,4 +31785,4 @@ var runKit = (config, identity, packages) => {
|
|
|
31760
31785
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
31761
31786
|
};
|
|
31762
31787
|
// .kitman-build-entry.ts
|
|
31763
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.
|
|
31788
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.10" }, []);
|
package/dist/declarations.json
CHANGED
|
@@ -1265,7 +1265,7 @@
|
|
|
1265
1265
|
{
|
|
1266
1266
|
"id": "file-tasks",
|
|
1267
1267
|
"title": "File Tasks",
|
|
1268
|
-
"version": "
|
|
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
|
-
"
|
|
1294
|
-
{
|
|
1295
|
-
"type": "string"
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
"type": "null"
|
|
1299
|
-
}
|
|
1300
|
-
]
|
|
1293
|
+
"type": "string"
|
|
1301
1294
|
},
|
|
1302
1295
|
"outOfScope": {
|
|
1303
|
-
"
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
"
|
|
2863
|
-
{
|
|
2864
|
-
"type": "string"
|
|
2865
|
-
},
|
|
2866
|
-
{
|
|
2867
|
-
"type": "null"
|
|
2868
|
-
}
|
|
2869
|
-
]
|
|
2885
|
+
"type": "string"
|
|
2870
2886
|
},
|
|
2871
2887
|
"outOfScope": {
|
|
2872
|
-
"
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
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
|
|
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.
|
|
5894
|
+
"version": "0.13.10",
|
|
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.
|
|
3
|
+
"version": "0.13.10",
|
|
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.
|
|
20
|
+
"@kitman-sh/sdk": "0.13.10",
|
|
21
21
|
"effect": "^4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"kitman": {
|
|
24
24
|
"bundle": "dist/bundle.js",
|
|
25
|
-
"digest": "
|
|
25
|
+
"digest": "3faba804520385bbca53011d02313670c85fe76668043252207913ce934c2703",
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
-
/**
|
|
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: '
|
|
27
|
+
version: '2.0.0',
|
|
19
28
|
title: 'File Tasks',
|
|
20
29
|
input: FileTasksInput,
|
|
21
30
|
output: Output,
|
|
22
|
-
agents: {},
|
|
23
|
-
checkout: '
|
|
24
|
-
capabilities: ['create_tasks'],
|
|
31
|
+
agents: { 'plan-reviewer': 'plan-reviewer' },
|
|
32
|
+
checkout: 'read',
|
|
33
|
+
capabilities: ['agent_work', 'create_tasks'],
|
|
25
34
|
run: input =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
})
|
package/src/plan-review.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { agentWork,
|
|
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
|
|
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:
|
|
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
|
-
|
|
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.
|
|
157
|
+
version: '2.1.0',
|
|
157
158
|
title: 'Research',
|
|
158
159
|
input: Input,
|
|
159
160
|
output: Output,
|