zelio-cli 0.0.0-stage → 0.1.0-beta.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/README.md +71 -2
- package/dist/attachments.js +121 -0
- package/dist/attachments.js.map +1 -0
- package/dist/cli-main.js +521 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/account.js +109 -0
- package/dist/cloud/account.js.map +1 -0
- package/dist/cloud/board.js +311 -0
- package/dist/cloud/board.js.map +1 -0
- package/dist/cloud/command.js +265 -0
- package/dist/cloud/command.js.map +1 -0
- package/dist/cloud/config.js +132 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/credentials.js +134 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/login.js +166 -0
- package/dist/cloud/login.js.map +1 -0
- package/dist/cloud/pair.js +110 -0
- package/dist/cloud/pair.js.map +1 -0
- package/dist/cloud/pkce.js +16 -0
- package/dist/cloud/pkce.js.map +1 -0
- package/dist/cloud/push-nudge.js +65 -0
- package/dist/cloud/push-nudge.js.map +1 -0
- package/dist/cloud/relay.js +134 -0
- package/dist/cloud/relay.js.map +1 -0
- package/dist/cloud/token.js +66 -0
- package/dist/cloud/token.js.map +1 -0
- package/dist/cloud/tunnel.js +474 -0
- package/dist/cloud/tunnel.js.map +1 -0
- package/dist/db/db.js +1838 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/lifecycle.js +146 -0
- package/dist/db/lifecycle.js.map +1 -0
- package/dist/limits.js +35 -0
- package/dist/limits.js.map +1 -0
- package/dist/metrics.js +30 -0
- package/dist/metrics.js.map +1 -0
- package/dist/orchestrator/area-notes.js +87 -0
- package/dist/orchestrator/area-notes.js.map +1 -0
- package/dist/orchestrator/claude-session.js +208 -0
- package/dist/orchestrator/claude-session.js.map +1 -0
- package/dist/orchestrator/codex-session.js +327 -0
- package/dist/orchestrator/codex-session.js.map +1 -0
- package/dist/orchestrator/contract.js +189 -0
- package/dist/orchestrator/contract.js.map +1 -0
- package/dist/orchestrator/explore.js +176 -0
- package/dist/orchestrator/explore.js.map +1 -0
- package/dist/orchestrator/new-task-prompt.js +51 -0
- package/dist/orchestrator/new-task-prompt.js.map +1 -0
- package/dist/orchestrator/pi-session.js +234 -0
- package/dist/orchestrator/pi-session.js.map +1 -0
- package/dist/orchestrator/prompt.js +110 -0
- package/dist/orchestrator/prompt.js.map +1 -0
- package/dist/orchestrator/research.js +193 -0
- package/dist/orchestrator/research.js.map +1 -0
- package/dist/orchestrator/retrieval.js +333 -0
- package/dist/orchestrator/retrieval.js.map +1 -0
- package/dist/orchestrator/runtime.js +1217 -0
- package/dist/orchestrator/runtime.js.map +1 -0
- package/dist/orchestrator/session.js +2 -0
- package/dist/orchestrator/session.js.map +1 -0
- package/dist/orchestrator/types.js +2 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/web.js +276 -0
- package/dist/orchestrator/web.js.map +1 -0
- package/dist/repo/code-map.js +152 -0
- package/dist/repo/code-map.js.map +1 -0
- package/dist/repo/index.js +188 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/instructions.js +58 -0
- package/dist/repo/instructions.js.map +1 -0
- package/dist/repo/linked-boards.js +149 -0
- package/dist/repo/linked-boards.js.map +1 -0
- package/dist/repo/project-repos.js +78 -0
- package/dist/repo/project-repos.js.map +1 -0
- package/dist/run/actions.js +257 -0
- package/dist/run/actions.js.map +1 -0
- package/dist/run/auto-review.js +116 -0
- package/dist/run/auto-review.js.map +1 -0
- package/dist/run/bash-guard.js +183 -0
- package/dist/run/bash-guard.js.map +1 -0
- package/dist/run/claude-runtime.js +284 -0
- package/dist/run/claude-runtime.js.map +1 -0
- package/dist/run/claude-stream.js +306 -0
- package/dist/run/claude-stream.js.map +1 -0
- package/dist/run/codex-client.js +213 -0
- package/dist/run/codex-client.js.map +1 -0
- package/dist/run/codex-planner-config.js +26 -0
- package/dist/run/codex-planner-config.js.map +1 -0
- package/dist/run/codex-runtime.js +469 -0
- package/dist/run/codex-runtime.js.map +1 -0
- package/dist/run/consult.js +109 -0
- package/dist/run/consult.js.map +1 -0
- package/dist/run/context.js +87 -0
- package/dist/run/context.js.map +1 -0
- package/dist/run/developer-sandbox.js +67 -0
- package/dist/run/developer-sandbox.js.map +1 -0
- package/dist/run/diff.js +238 -0
- package/dist/run/diff.js.map +1 -0
- package/dist/run/evidence.js +48 -0
- package/dist/run/evidence.js.map +1 -0
- package/dist/run/finish.js +430 -0
- package/dist/run/finish.js.map +1 -0
- package/dist/run/handoff.js +51 -0
- package/dist/run/handoff.js.map +1 -0
- package/dist/run/harness-runtime.js +31 -0
- package/dist/run/harness-runtime.js.map +1 -0
- package/dist/run/harnesses.js +293 -0
- package/dist/run/harnesses.js.map +1 -0
- package/dist/run/issue.js +79 -0
- package/dist/run/issue.js.map +1 -0
- package/dist/run/keep-awake.js +58 -0
- package/dist/run/keep-awake.js.map +1 -0
- package/dist/run/lead.js +183 -0
- package/dist/run/lead.js.map +1 -0
- package/dist/run/manager.js +2737 -0
- package/dist/run/manager.js.map +1 -0
- package/dist/run/mentions.js +35 -0
- package/dist/run/mentions.js.map +1 -0
- package/dist/run/merge-watch.js +425 -0
- package/dist/run/merge-watch.js.map +1 -0
- package/dist/run/models.js +88 -0
- package/dist/run/models.js.map +1 -0
- package/dist/run/phases.js +23 -0
- package/dist/run/phases.js.map +1 -0
- package/dist/run/pi-packages.js +72 -0
- package/dist/run/pi-packages.js.map +1 -0
- package/dist/run/pi-rpc.js +464 -0
- package/dist/run/pi-rpc.js.map +1 -0
- package/dist/run/piped-check.js +56 -0
- package/dist/run/piped-check.js.map +1 -0
- package/dist/run/pr-checks.js +67 -0
- package/dist/run/pr-checks.js.map +1 -0
- package/dist/run/pr-merge.js +121 -0
- package/dist/run/pr-merge.js.map +1 -0
- package/dist/run/profiles.js +43 -0
- package/dist/run/profiles.js.map +1 -0
- package/dist/run/prompt.js +405 -0
- package/dist/run/prompt.js.map +1 -0
- package/dist/run/pull-request.js +23 -0
- package/dist/run/pull-request.js.map +1 -0
- package/dist/run/red-check.js +130 -0
- package/dist/run/red-check.js.map +1 -0
- package/dist/run/result-tool.js +93 -0
- package/dist/run/result-tool.js.map +1 -0
- package/dist/run/result.js +113 -0
- package/dist/run/result.js.map +1 -0
- package/dist/run/retro.js +346 -0
- package/dist/run/retro.js.map +1 -0
- package/dist/run/settings.js +28 -0
- package/dist/run/settings.js.map +1 -0
- package/dist/run/skills.js +146 -0
- package/dist/run/skills.js.map +1 -0
- package/dist/run/tests-first.js +146 -0
- package/dist/run/tests-first.js.map +1 -0
- package/dist/run/thinking.js +41 -0
- package/dist/run/thinking.js.map +1 -0
- package/dist/run/types.js +2 -0
- package/dist/run/types.js.map +1 -0
- package/dist/run/watchdog.js +266 -0
- package/dist/run/watchdog.js.map +1 -0
- package/dist/run/workflow.js +277 -0
- package/dist/run/workflow.js.map +1 -0
- package/dist/run/worktree.js +354 -0
- package/dist/run/worktree.js.map +1 -0
- package/dist/server/app.js +3286 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.js +93 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/demo.js +96 -0
- package/dist/server/demo.js.map +1 -0
- package/dist/server/idempotency.js +104 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/port.js +36 -0
- package/dist/server/port.js.map +1 -0
- package/dist/server/principal.js +93 -0
- package/dist/server/principal.js.map +1 -0
- package/dist/server/provider-auth.js +206 -0
- package/dist/server/provider-auth.js.map +1 -0
- package/dist/server/repo-picker.js +18 -0
- package/dist/server/repo-picker.js.map +1 -0
- package/dist/server/terminal.js +285 -0
- package/dist/server/terminal.js.map +1 -0
- package/dist/setup/components.js +98 -0
- package/dist/setup/components.js.map +1 -0
- package/dist/setup/config.js +71 -0
- package/dist/setup/config.js.map +1 -0
- package/dist/setup/ink-ui.js +189 -0
- package/dist/setup/ink-ui.js.map +1 -0
- package/dist/setup/onboarding.js +157 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/run.js +69 -0
- package/dist/setup/run.js.map +1 -0
- package/dist/skills.js +151 -0
- package/dist/skills.js.map +1 -0
- package/dist/ticket-cli.js +157 -0
- package/dist/ticket-cli.js.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/dist/voice/index.js +69 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/moonshine.js +247 -0
- package/dist/voice/moonshine.js.map +1 -0
- package/dist/voice/wav.js +54 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/voice/whisper.js +491 -0
- package/dist/voice/whisper.js.map +1 -0
- package/dist/web/assets/index-TN5sUF2z.css +1 -0
- package/dist/web/assets/index-vB3Cucuc.js +258 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +21 -0
- package/dist/web/manifest.webmanifest +30 -0
- package/dist/web/sw.js +185 -0
- package/media/board.png +0 -0
- package/media/mobile.png +0 -0
- package/media/new-task.png +0 -0
- package/media/review.png +0 -0
- package/package.json +105 -4
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What both planners must produce, word for word.
|
|
3
|
+
*
|
|
4
|
+
* Two doors write cards: the chat in the panel and the new-task dialog. They
|
|
5
|
+
* have different doctrine — one is helping a person decide, the other is
|
|
6
|
+
* writing a card from a description they already gave — but they emit the same
|
|
7
|
+
* JSON to the same parser, and the rules for what makes a card checkable are
|
|
8
|
+
* not a matter of taste. Sharing the text is cheaper than keeping two copies in
|
|
9
|
+
* step, and a field that exists in one door's schema and not the other's is a
|
|
10
|
+
* bug the parser would only find late.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately not here: when to draft, how to ask, how to split. Those are each
|
|
13
|
+
* door's own business.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* How many separately-checkable behaviours one card may carry before it is two
|
|
17
|
+
* cards wearing one title. Four is enough for a behaviour, its reload, and its
|
|
18
|
+
* failure case; beyond that the card is a project, and the run it starts proves
|
|
19
|
+
* that by taking an hour and writing a harness of its own to check it.
|
|
20
|
+
*/
|
|
21
|
+
export const MAX_CARD_CHECKS = 4;
|
|
22
|
+
/**
|
|
23
|
+
* How many facts a card may carry into the run. Six is enough to name the
|
|
24
|
+
* writer, the reader, the test, and a reuse target without turning the card
|
|
25
|
+
* into a second transcript; the parser clamps it because a prompt is a request.
|
|
26
|
+
*/
|
|
27
|
+
export const MAX_CARD_CONTEXT = 6;
|
|
28
|
+
/** One fact is a line, not a paragraph. The parser clips it at a word boundary. */
|
|
29
|
+
export const MAX_CONTEXT_CHARS = 400;
|
|
30
|
+
/**
|
|
31
|
+
* The checks inside an acceptance sentence, by the separators a card actually
|
|
32
|
+
* uses: `;` between behaviours, and a full stop before a new capitalised or
|
|
33
|
+
* bracketed clause. Deliberately generous about what counts as a check: a card
|
|
34
|
+
* that reads as five things is five things whether or not it was punctuated
|
|
35
|
+
* like it.
|
|
36
|
+
*/
|
|
37
|
+
export function acceptanceChecks(acceptance) {
|
|
38
|
+
return acceptance
|
|
39
|
+
.split(/;|\.\s+(?=[A-Z(`"'])/)
|
|
40
|
+
.map((part) => part.trim().replace(/\.$/, ""))
|
|
41
|
+
.filter((part) => part.length > 0);
|
|
42
|
+
}
|
|
43
|
+
/** Cards whose acceptance asks for more than one ticket's worth of proof. */
|
|
44
|
+
export function oversizedCards(cards) {
|
|
45
|
+
return cards
|
|
46
|
+
.map((card) => ({ title: card.title, checks: acceptanceChecks(card.acceptance) }))
|
|
47
|
+
.filter((card) => card.checks.length > MAX_CARD_CHECKS);
|
|
48
|
+
}
|
|
49
|
+
/** What a ticket must contain, and the one rule that keeps review meaningful. */
|
|
50
|
+
export const TICKET_RULES = `## What a ticket must contain
|
|
51
|
+
|
|
52
|
+
- **title** — imperative, specific, no "improve" or "refactor".
|
|
53
|
+
- **goal** — three short parts on one line, in the person's terms: \`Today: <what they see or do now>. After: <what changes for them>. Done when: <the one thing they can observe that shows it worked>.\` It is what the developer turns into its first tests, so it names what a person sees, never a file or a function. "Done when" is the outcome, not the activity.
|
|
54
|
+
- **out_of_scope** — at least one thing explicitly excluded. A ticket with no boundary is a wish. Never exclude a path you found that could cause what the person reported: a card that fixes one cause and scopes out another passes its checks and leaves the person's problem in place. Cover it in the card, or ask which path they used. When a needed part lives in a repository listed in \`<project-repos>\`, write it as its own card with \`board\`. When it lives in a repository not on this board, keep the card's goal and acceptance to what this board can prove, and say in \`reply\` that the person can add that repository from the project page.
|
|
55
|
+
- **acceptance** — two to four things a person could observe once the work is done, one sentence each, and one of them is a failure case. Say what is observed and where it is entered: the screen and the click, the endpoint and the response, the command and its output. Do not say how it is built: function names, data shapes and test files belong to the developer, who reads the code; a mechanism the run must use goes in \`context\`. Never "works correctly", never "is clean".
|
|
56
|
+
- **at most four checks** — one card proves one behaviour. If the work needs a fifth check, split it into cards that each stand alone, and let the person confirm every one.
|
|
57
|
+
- **the repository's own rules win** — if the repo documents how to work (\`AGENTS.md\`, \`CLAUDE.md\`), read it before writing acceptance. Its commands, tests and commit style are the person's standing preference, and a card that contradicts them is wrong.
|
|
58
|
+
- **likely_files** — paths or directories you expect to be touched, from actually reading the repo. Navigation hints, not a permission boundary; necessary supporting files remain authorized.
|
|
59
|
+
- **verify** — the commands the board runs to decide the card is done, each as \`{ "label", "command" }\`, at most six. Every acceptance criterion needs at least one command that would fail before the change and pass after it, usually an explicit-path test file the developer adds or extends. Tests are authorized supporting work of the card, never a card of their own. Use repo scripts or explicit test paths, never the full test suite. A command outside the configured workflow must already exist in \`package.json\`, a workspace script, CI, or repo docs; never invent one. A verify command judges the tree, it never changes it: no formatter or fixer (\`pnpm fmt\`, \`lint:fix\`, \`--fix\`, \`--write\`), and none of the In Progress workflow's checks, which the board already runs after every turn.
|
|
60
|
+
- **Board-owned process stays out of the card.** Commit, push, review, and delegation behavior belongs to the board. If a person's instruction conflicts with that lifecycle (for example, "do not push" when the board publishes verified tickets automatically), say so plainly in \`reply\` before they confirm; never promise that the board will honor the instruction. Do not copy such process instructions into acceptance or \`out_of_scope\`. Preserve executable constraints on implementation when the card can enforce them: put them in the goal or acceptance if they change an observable outcome, otherwise in \`context\` (for example, a required tool or a prohibition on adding a dependency). Repository-reading and reporting preferences are not ticket behavior.
|
|
61
|
+
- **context** — the facts and executable implementation constraints the run would otherwise have to rediscover, one per line, as \`path:line — what is true there\`, \`reuse — the helper and where it lives\`, or a concise constraint from the person. Not a summary of the card; the mechanism or constraint. If the ticket names a file, the run should not have to guess why. Repo facts must come from what you read; user constraints may be copied from their request.
|
|
62
|
+
- **plan** — optional concise implementation handoff in markdown: observed code paths, invariants, user journey, risks, unknowns, and useful verification. Read relevant code first; mark unresolved facts as unknown. Keep simple tasks brief. The developer checks it against current code and may adapt it. Never copy it into project files.
|
|
63
|
+
- **rationale** — one line: why this ticket exists, in the user's terms.
|
|
64
|
+
- **assumed** — every choice you made yourself, as "field: what you assumed". Not "acceptance" — the actual assumption, e.g. "acceptance: assumed matching is case-insensitive". If you assumed nothing that changes behaviour, leave it empty. An assumption that changes how the work is built belongs in the goal or acceptance fields too: the developer run does not receive that field, so a mechanism kept only there is a mechanism the agent has to guess.
|
|
65
|
+
|
|
66
|
+
## The card is the whole brief
|
|
67
|
+
|
|
68
|
+
The developer run sees the card, not this conversation. Write for an implementer who cannot ask you a follow-up question: if the work depends on a file, a helper, or a mechanism you learned by reading, put it in \`context\`. An implementer who has to re-derive your understanding will choose a different design.
|
|
69
|
+
|
|
70
|
+
## The rule that matters most
|
|
71
|
+
|
|
72
|
+
**Never invent the user's acceptance criteria from your own preference.** If you write the criteria and another agent does the work, you both agree with each other and the check is theatre. Derive each criterion from the user's words or from something you read in the repo. Anything you had to make up goes in \`assumed\`, and a person edits it before approving.
|
|
73
|
+
|
|
74
|
+
**Out of scope is an exclusion, never a restatement.** "Only the board shell needs to go dark" is scope; "the token gate stays as it is" is the exclusion you write down. If a sentence from the person describes what to build, it belongs in the goal, not here.
|
|
75
|
+
|
|
76
|
+
**Acceptance is never the person's message pasted back.** "Toggle is light/dark only, persisted in localStorage" is a request, not a check. Rewrite it as an observation someone can make: which element changes, what the file or the screen looks like afterwards.
|
|
77
|
+
|
|
78
|
+
When their answer settles one of your assumptions, that decision is theirs now: remove it from \`assumed\`. Every line left there must still be something they have not decided.
|
|
79
|
+
|
|
80
|
+
If the answer changes the shape of the work — which approach, which surface, what "done" means — ask. Asking beats a confident wrong plan.
|
|
81
|
+
|
|
82
|
+
If one user outcome needs multiple cards, retain its full intent and acceptance across them, state genuine dependencies, and name who owns cross-card integration and final end-to-end verification. Individual green cards do not prove the complete user flow.
|
|
83
|
+
|
|
84
|
+
**Cards that share an interface share its contract.** When one card produces a message, endpoint, event or file that another card consumes, read the code on both sides before writing either card, and write the exact shape — fields, what each value means, and what is sent when nothing succeeds — into both cards' \`context\`. Producing it belongs in the producing card's acceptance. If a consumer's acceptance needs something back (a delivery result, an error, a status) and the existing channel sends nothing back, the reply is the producer card's work, not the consumer's. A side you did not read goes in \`assumed\`.
|
|
85
|
+
|
|
86
|
+
## Before a card is ready to run
|
|
87
|
+
|
|
88
|
+
A card is permission to run an agent, not a wish. Every card:
|
|
89
|
+
|
|
90
|
+
- **It has a failure case.** One criterion describes what the person sees when the work fails, is empty, is stale, or is missing. If there is genuinely no failure path, say why in \`assumed\`.
|
|
91
|
+
- **The proof matches the claim.** If a criterion says something must not happen, it asks for evidence that it did not — a call never made, a row never written — not a hidden output or a trace.
|
|
92
|
+
|
|
93
|
+
Only when the card's work calls for it — most cards need neither:
|
|
94
|
+
|
|
95
|
+
- **The resource boundary is explicit** when the work deletes, moves, renames, or retires something: acceptance names the exact resource this ticket owns and includes one absence proof, such as another branch still exists, the default branch is untouched, or a live run stopped.
|
|
96
|
+
- **The board's invariants still win** when the work changes text an agent reads (a prompt, a config, a workflow), how a run reports status, worktrees, or review. Acceptance proves that no card, prompt or config gains another way to report status than \`ZELIO_STATUS_URL\`, a second worktree, or a way past human review. A card that changes what an agent is told names the change in \`assumed\`; it does not skip acceptance either.
|
|
97
|
+
|
|
98
|
+
Before you put a card in the block, read it as the reviewer who has to approve it: if you cannot point at the failure it handles, it is not ready.`;
|
|
99
|
+
/**
|
|
100
|
+
* What both doors read before they write a card.
|
|
101
|
+
*
|
|
102
|
+
* The prompts differ on what a turn is — a conversation, or one description —
|
|
103
|
+
* but not on what counts as knowing the repo. Shared so a lesson learned at one
|
|
104
|
+
* door reaches the other, and so neither doctrine can quietly drop the reading
|
|
105
|
+
* that makes acceptance checkable.
|
|
106
|
+
*/
|
|
107
|
+
export const PLANNING_METHOD = `## Read before you write
|
|
108
|
+
|
|
109
|
+
- **Find the nearest existing thing.** The file that already does part of this job, the test that will judge it, and the surface or command that enters it. Read all three before you draft a card.
|
|
110
|
+
- **Trace the path end to end.** Which component calls what, what stores it, what reads it back. If you cannot name the writer and the reader, acceptance is guesswork.
|
|
111
|
+
- **Identify change impact.** For changed behavior, identify affected existing workflows and their normal transitions. Specify observable evidence that those transitions remain usable, including journeys beyond the narrowly requested behavior; fit the evidence into the existing card limits.
|
|
112
|
+
- **Follow changed values to their effect.** Start at the user action or source that sets the value, then trace only the affected path through storage or transport, each consumer on that path, and the runtime behavior it controls. Use code search and supplied findings to locate the path; open the source at each handoff to confirm where the value can be dropped or transformed and what must stay true. Do not inspect unrelated consumers. A picker or saved value alone does not prove the requested behavior; acceptance must reach the consumer and observe the intended outcome.
|
|
113
|
+
- **Read the callers before reusing a shape.** A helper that looks right may belong to another surface; copy the pattern only after seeing what else depends on it.
|
|
114
|
+
- **Check the conventions where the change lands.** Naming, error handling, test style. A card that ignores them makes work for the reviewer.
|
|
115
|
+
- **Prefer evidence over coverage.** Three files read beat ten files listed. What you did not read is an assumption, not a fact.
|
|
116
|
+
- **Name the proof path.** Before you write acceptance, name the surface the change enters and the path a person takes through it: the screen and the click, the endpoint and the request, the command and its output. For a changed value or setting, carry that same affected path through the consumer to the behavior it controls; proving only that it appears or is stored is insufficient. A criterion that cannot be reached from that path is a wish, not a check.
|
|
117
|
+
- **Send the scout when one question needs several files.** The \`explore\` tool returns cited findings from a read-only pass and keeps your own turn for synthesis. Ask it where a path starts, what stores a value, and which test would judge the change; do not ask it to write the card.
|
|
118
|
+
- **Open what the scout cites.** A citation you did not open is an assumption, not evidence. Read the two or three files that decide the mechanism before you write the card.
|
|
119
|
+
- **Agree on a verification standard.** Acceptance must say what observable evidence establishes the required behavior, not demand an unspecified absolute proof of correctness or security. Name required proofs, their properties and assumptions when relevant. Distinguish implementation verification from explicitly later independent review, audit, or deployment gates, and name the later gate's owner. A developer cannot move a required proof into later assurance or substitute passing tests for it. Ready for Review means ready for human scrutiny, never permission to merge or deploy.
|
|
120
|
+
- **Classify run outcomes from evidence.** A missing status or exhausted retry means only that no status was reported; it does not prove the ticket is too large, incomplete, or unverified. For a run handoff, use only a failure or check result supplied by the person or found in files you actually read; the board may not expose run logs. Put the observed failure, proof already run, and cheapest existing relevant verification command you found in \`context\`; put unknown facts and guessed causes in \`assumed\`. Do not claim a command passed without observed output. Do not invent completed work, a credentials failure, or routine commit/push/PR criteria: add those lifecycle steps to acceptance only when the person explicitly asks.`;
|
|
121
|
+
/** The block, its rules, and the fields the parser depends on. */
|
|
122
|
+
export const OUTPUT_CONTRACT = `## Output
|
|
123
|
+
|
|
124
|
+
Reply in plain prose for the person: what you found, what you are unsure about, what you would do. Keep it under 120 words. Then exactly one fenced json block, no other code blocks:
|
|
125
|
+
|
|
126
|
+
\`\`\`json
|
|
127
|
+
{
|
|
128
|
+
"reply": "the same short message, or a one-line summary",
|
|
129
|
+
"questions": [
|
|
130
|
+
{
|
|
131
|
+
"id": "q1",
|
|
132
|
+
"text": "Reuse the existing digests table or add one?",
|
|
133
|
+
"derived": true,
|
|
134
|
+
"evidence": "src/db/db.ts:88 already has a digests table",
|
|
135
|
+
"options": [
|
|
136
|
+
{
|
|
137
|
+
"id": "q1o1",
|
|
138
|
+
"label": "Reuse the existing table",
|
|
139
|
+
"cost": "+40 lines, db.ts, needs a backfill test",
|
|
140
|
+
"recommended": true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "q1o2",
|
|
144
|
+
"label": "Add a second table",
|
|
145
|
+
"cost": "+120 lines, a second join, one more migration"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"cards": [
|
|
151
|
+
{
|
|
152
|
+
"id": "c1",
|
|
153
|
+
"title": "Add title search to the board",
|
|
154
|
+
"goal": "Today: finding a ticket means scanning every column. After: typing part of a title filters the board to matching tickets. Done when: typing 'token' leaves only tickets whose title contains it.",
|
|
155
|
+
"out_of_scope": "Full-text search over goals and comments.",
|
|
156
|
+
"acceptance": "Typing 'token' filters the board to tickets whose title matches, ignoring case; clearing the box restores all columns; a failed query keeps the previous list and shows an error.",
|
|
157
|
+
"likely_files": ["src/web/components/top-bar.tsx", "src/web/App.tsx"],
|
|
158
|
+
"verify": [{ "label": "title filter test", "command": "pnpm test test/top-bar.test.ts" }],
|
|
159
|
+
"context": [
|
|
160
|
+
"src/web/components/top-bar.tsx:41 — the search box already writes the filter to the URL",
|
|
161
|
+
"reuse src/web/components/search-palette.tsx:41 — the palette already matches titles"
|
|
162
|
+
],
|
|
163
|
+
"plan": "## Code paths\\n- ...\\n## Invariants\\n- ...\\n## User journey\\n- ...\\n## Risks and unknowns\\n- ...\\n## Verification\\n- ...",
|
|
164
|
+
"thinking": "low",
|
|
165
|
+
"rationale": "You said finding a ticket by title is the slow part.",
|
|
166
|
+
"assumed": ["out_of_scope: assumed comments and goals are not searched"],
|
|
167
|
+
"decided": ["acceptance: person chose case-insensitive matching"]
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
Rules for the block:
|
|
174
|
+
- The prose and the block must agree. If \`cards\` is empty, do not say you made a draft. If it is not empty, tell the person the drafts are ready to look at.
|
|
175
|
+
- A greeting or a question about you is still a turn: answer it in prose and still end with the block, with \`questions: []\` and \`cards: []\`. The block is how the board knows you looked, even when there is nothing to plan.
|
|
176
|
+
- \`id\`: echo the id from \`<draft-plan>\`, or omit it for a card that is new. Never renumber.
|
|
177
|
+
- \`questions\`: what you still cannot decide without the person. At most three, each with two to four options, each option with a one-line cost. Asking and drafting in the same turn is allowed when they have asked for the draft and the cards are honest without the answer.
|
|
178
|
+
- \`decided\`: the answers the person actually gave, as "field: what they chose". It is not a place for your own reasoning: anything you decided goes in \`assumed\`. When an answer settles a field, move that line from \`assumed\` to \`decided\` and keep their wording.
|
|
179
|
+
- \`cards\`: at most 5. Empty on a discussion turn, or whenever they have not asked you to turn the work into a draft.
|
|
180
|
+
- \`thinking\`: how much effort the developer run should spend on this card, as \`low\`, \`medium\` or \`high\`. Set it on every card. \`low\` is mechanical work: a rename, a copy change, a prop wired through. Choose \`high\` when being wrong is expensive and cheap checks will not catch it — concurrency, process lifecycles, native code, auth and the tunnel allowlist, money, or a behaviour a person can only confirm by hand. Choose \`medium\` for work that is mostly mechanical but has one sharp edge. Judge the card, not the size of the diff.
|
|
181
|
+
- \`model\`: the developer run's model for this card, copied exactly from the list in \`<developer-run>\`. Omit it when the default model fits, when there is no \`<developer-run>\`, or when its list is empty; a model not on the list is dropped. Prefer cheap or mid-tier models for cards at every effort level: pick the cheapest, fastest model that can reasonably handle the work (for example \`haiku\` for Claude, \`luna\` or \`terra\` for Codex), including for \`high\` effort cards. Do not escalate to strongest models such as Astra or Opus just because effort is \`high\`. Use only models from the harness named there. When you cannot tell which listed model is cheaper or mid-tier, omit it.
|
|
182
|
+
- \`skills\`: ids of skills the developer run should read for this card, copied exactly from the skills list in \`<developer-run>\`. The run gets each chosen skill's whole text, so choose only the ones this card's work needs — a frontend skill for UI work, not for a database migration — and omit the field when none fits or none is listed. An id not on the list is dropped.
|
|
183
|
+
- Field shapes: \`reply\`, every \`id\`, and the text fields are strings; \`likely_files\`, \`context\`, \`skills\`, \`assumed\` and \`decided\` are arrays of strings; \`derived\` and \`recommended\` are booleans; \`questions\` and \`options\` are arrays of objects. \`evidence\` is the repo path or fact behind a derived question, and \`cost\` is the one-line price of an option, so neither is optional when that field is present.
|
|
184
|
+
- \`context\`: at most six lines. Each is a fact you verified, not a restatement of the goal. An empty array is honest when the ticket has no surprising mechanism; do not pad it.
|
|
185
|
+
- \`plan\`: for non-trivial work, include a concise per-ticket handoff with observed code paths, invariants, user journey, risks, unknowns and useful verification. Base claims on repository reading; explicitly label unknowns. A simple task may have no plan. The plan stays as board ticket data, not a project file.
|
|
186
|
+
- \`assumed\` states each choice you made for the person, in the form "field: what you assumed". An empty array means the card needs no edit before it can run — so leave it empty when that is true, and do not pad it with fields you did not really decide.
|
|
187
|
+
- \`likely_files\` is what tells two cards apart. Guessing it badly is how parallel agents collide.
|
|
188
|
+
- \`board\`: omit it. Set it only to a name listed in \`<project-repos>\`, for a card whose work lives in that repository; a card with any other board is dropped.`;
|
|
189
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/orchestrator/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,OAAO,UAAU;SACd,KAAK,CAAC,sBAAsB,CAAC;SAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SAC7C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAC5B,KAAuD;IAEvD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;SACjF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;AAC5D,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mJAgDuH,CAAC;AAEpJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;guBAaisB,CAAC;AAEjuB,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mKAkEoI,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A read-only scout the planner can send into the repo.
|
|
3
|
+
*
|
|
4
|
+
* The planner's own turn is bounded, and its context is the card it has to
|
|
5
|
+
* write. A question like "where does a ticket transition write status, and what
|
|
6
|
+
* test covers it" needs six to ten reads that should not land in the planner's
|
|
7
|
+
* transcript one result at a time. This spawns a second pi with only
|
|
8
|
+
* read/grep/find/ls, gets a cited answer back, and keeps the planner's context
|
|
9
|
+
* for synthesis.
|
|
10
|
+
*
|
|
11
|
+
* The scout cannot write, cannot run a shell, and has no extension: it is the
|
|
12
|
+
* same read-only contract as the planner, one level down. Its output is treated
|
|
13
|
+
* as untrusted prose like a fetched page; the planner still has to cite it.
|
|
14
|
+
*/
|
|
15
|
+
import { spawn } from "node:child_process";
|
|
16
|
+
import { thinkingArgs } from "../run/thinking.js";
|
|
17
|
+
/** Enough to trace a path and its test; small enough that the wait stays bounded. */
|
|
18
|
+
export const SCOUT_TOOL_BUDGET = 12;
|
|
19
|
+
/** The outer planning turn is 240s; a scout that eats half of it is too slow. */
|
|
20
|
+
export const SCOUT_TIMEOUT_MS = 90_000;
|
|
21
|
+
/** More than this is a document, not an answer to one question. */
|
|
22
|
+
export const SCOUT_MAX_ANSWER_CHARS = 8_000;
|
|
23
|
+
export const SCOUT_PROMPT = `You are a read-only repository scout for Zelio's planner. You answer one question about this repo with evidence, then stop.
|
|
24
|
+
|
|
25
|
+
Rules:
|
|
26
|
+
- Read the repo. You cannot write, run a shell, or change anything.
|
|
27
|
+
- Find the entry point, the store, and the test that would judge it. Cite every claim as path:line.
|
|
28
|
+
- Answer in at most 300 words: the answer first, then an "Evidence:" list, one path:line per line with why it matters.
|
|
29
|
+
- If you cannot find it, say what you searched and where you looked. Never guess, never propose a card, never write code.`;
|
|
30
|
+
/**
|
|
31
|
+
* One question in, one cited answer out.
|
|
32
|
+
*
|
|
33
|
+
* The scout is steered at its tool limit and stopped a few calls later, the
|
|
34
|
+
* same protocol the planner uses: a ceiling that only exists in the prompt is a
|
|
35
|
+
* request, and a scout that ignores it must not become an unbounded process.
|
|
36
|
+
*/
|
|
37
|
+
export async function scoutRepo(options) {
|
|
38
|
+
const question = options.question.trim();
|
|
39
|
+
if (!question)
|
|
40
|
+
throw new Error("explore needs a question to answer");
|
|
41
|
+
if (options.signal?.aborted)
|
|
42
|
+
throw new Error("explore was cancelled");
|
|
43
|
+
const paths = (options.paths ?? [])
|
|
44
|
+
.filter((path) => typeof path === "string" && path.trim().length > 0)
|
|
45
|
+
.map((path) => path.trim())
|
|
46
|
+
.slice(0, 12);
|
|
47
|
+
const command = options.command ?? process.env.ZELIO_HARNESS ?? "pi";
|
|
48
|
+
const timeoutMs = options.timeoutMs ?? SCOUT_TIMEOUT_MS;
|
|
49
|
+
const maxToolCalls = options.maxToolCalls ?? SCOUT_TOOL_BUDGET;
|
|
50
|
+
const prompt = [
|
|
51
|
+
"Question:",
|
|
52
|
+
question,
|
|
53
|
+
...(paths.length > 0 ? ["", "Start here:", ...paths.map((path) => `- ${path}`)] : []),
|
|
54
|
+
"",
|
|
55
|
+
"Answer with findings and cited paths. No card, no code, no plan.",
|
|
56
|
+
].join("\n");
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const child = spawn(command, [
|
|
59
|
+
"--mode",
|
|
60
|
+
"rpc",
|
|
61
|
+
"--no-session",
|
|
62
|
+
"--no-mcp",
|
|
63
|
+
"--no-extensions",
|
|
64
|
+
"--no-skills",
|
|
65
|
+
"--no-prompt-templates",
|
|
66
|
+
"--no-context-files",
|
|
67
|
+
"--tools",
|
|
68
|
+
"read,grep,find,ls",
|
|
69
|
+
"--system-prompt",
|
|
70
|
+
SCOUT_PROMPT,
|
|
71
|
+
...thinkingArgs("low"),
|
|
72
|
+
], { cwd: options.cwd ?? process.cwd(), stdio: ["pipe", "pipe", "pipe"] });
|
|
73
|
+
let text = "";
|
|
74
|
+
let stderr = "";
|
|
75
|
+
let calls = 0;
|
|
76
|
+
let steered = false;
|
|
77
|
+
let stopped = false;
|
|
78
|
+
let timedOut = false;
|
|
79
|
+
let finished = false;
|
|
80
|
+
const finish = (settle) => {
|
|
81
|
+
if (finished)
|
|
82
|
+
return;
|
|
83
|
+
finished = true;
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
options.signal?.removeEventListener("abort", abort);
|
|
86
|
+
settle();
|
|
87
|
+
};
|
|
88
|
+
const send = (record) => {
|
|
89
|
+
if (child.killed)
|
|
90
|
+
return;
|
|
91
|
+
try {
|
|
92
|
+
child.stdin.write(`${JSON.stringify(record)}\n`);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// `close`/`error` already decides the outcome.
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const abort = () => {
|
|
99
|
+
finish(() => reject(new Error("explore was cancelled")));
|
|
100
|
+
child.kill("SIGKILL");
|
|
101
|
+
};
|
|
102
|
+
const timer = setTimeout(() => {
|
|
103
|
+
timedOut = true;
|
|
104
|
+
child.kill("SIGKILL");
|
|
105
|
+
}, timeoutMs);
|
|
106
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
107
|
+
child.stdin.on("error", () => { });
|
|
108
|
+
child.on("error", (error) => {
|
|
109
|
+
finish(() => reject(new Error(`${command}: ${error.message}`)));
|
|
110
|
+
});
|
|
111
|
+
child.stderr.setEncoding("utf8");
|
|
112
|
+
child.stderr.on("data", (chunk) => {
|
|
113
|
+
stderr = (stderr + chunk).slice(-2000);
|
|
114
|
+
});
|
|
115
|
+
// Split on LF only, like the planner's parser: U+2028 inside JSON is legal
|
|
116
|
+
// and `readline` would cut a message in half.
|
|
117
|
+
let buffer = "";
|
|
118
|
+
child.stdout.setEncoding("utf8");
|
|
119
|
+
child.stdout.on("data", (chunk) => {
|
|
120
|
+
buffer += chunk;
|
|
121
|
+
let newline;
|
|
122
|
+
while ((newline = buffer.indexOf("\n")) !== -1) {
|
|
123
|
+
const line = buffer.slice(0, newline).replace(/\r$/, "");
|
|
124
|
+
buffer = buffer.slice(newline + 1);
|
|
125
|
+
if (!line.trim())
|
|
126
|
+
continue;
|
|
127
|
+
let record;
|
|
128
|
+
try {
|
|
129
|
+
record = JSON.parse(line);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (record.type === "message_update" &&
|
|
135
|
+
record.assistantMessageEvent?.type === "text_delta") {
|
|
136
|
+
text += record.assistantMessageEvent.delta ?? "";
|
|
137
|
+
}
|
|
138
|
+
if (record.type === "tool_execution_start") {
|
|
139
|
+
calls += 1;
|
|
140
|
+
if (calls >= maxToolCalls && !steered) {
|
|
141
|
+
steered = true;
|
|
142
|
+
send({
|
|
143
|
+
id: "scout-budget",
|
|
144
|
+
type: "steer",
|
|
145
|
+
message: `You have used ${calls} tool calls. Answer now from what you read, with cited paths.`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (calls > maxToolCalls + 3 && !stopped) {
|
|
149
|
+
stopped = true;
|
|
150
|
+
send({ id: "scout-stop", type: "abort" });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// No wrap-up turn: the scout is research, not the card. When it
|
|
154
|
+
// settles, whatever it wrote is the answer.
|
|
155
|
+
if (record.type === "agent_settled")
|
|
156
|
+
child.stdin.end();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
child.on("close", (code) => {
|
|
160
|
+
const answer = text.trim();
|
|
161
|
+
if (timedOut) {
|
|
162
|
+
return finish(() => reject(new Error(`explore timed out after ${timeoutMs}ms`)));
|
|
163
|
+
}
|
|
164
|
+
if (!answer) {
|
|
165
|
+
const tail = stderr.trim().slice(-500);
|
|
166
|
+
return finish(() => reject(new Error(`${command} exited ${code}: ${tail || "the scout wrote no answer"}`)));
|
|
167
|
+
}
|
|
168
|
+
const clipped = answer.length > SCOUT_MAX_ANSWER_CHARS
|
|
169
|
+
? `${answer.slice(0, SCOUT_MAX_ANSWER_CHARS)}\n… (${answer.length - SCOUT_MAX_ANSWER_CHARS} more characters)`
|
|
170
|
+
: answer;
|
|
171
|
+
finish(() => resolve(clipped));
|
|
172
|
+
});
|
|
173
|
+
send({ id: "explore-1", type: "prompt", message: prompt });
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=explore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore.js","sourceRoot":"","sources":["../../src/orchestrator/explore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM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AG,sBAAsB,mBAAmB;gBAC7G,CAAC,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { OUTPUT_CONTRACT, PLANNING_METHOD, TICKET_RULES } from "./contract.js";
|
|
2
|
+
/**
|
|
3
|
+
* The new-task dialog's planner, and its own thing.
|
|
4
|
+
*
|
|
5
|
+
* The panel's prompt is a chat's doctrine: when to draft, how a draft changes
|
|
6
|
+
* across turns, what to do when the subject moves. None of that is this job.
|
|
7
|
+
* Here the person described a task in one box and is looking at the result, so
|
|
8
|
+
* the work is: read the repo, write the card, ask only what would change it.
|
|
9
|
+
*
|
|
10
|
+
* It is a separate unit on purpose, not a mode of the other one. If this door
|
|
11
|
+
* turns out to be the whole product — a person types what they want and gets a
|
|
12
|
+
* ticket, without ever opening the panel — then this file keeps growing and the
|
|
13
|
+
* orchestrator's prompt becomes the optional one. Two doctrines sharing a
|
|
14
|
+
* contract can do that; one prompt with a mode flag cannot.
|
|
15
|
+
*/
|
|
16
|
+
export const NEW_TASK_PROMPT = `You are the planner behind Zelio's new-task dialog, a local kanban board for supervising coding agents.
|
|
17
|
+
|
|
18
|
+
A person described a piece of work in one box. You are not having a conversation with them. Your job is to turn that description into the smallest number of draft tickets that would do the work, asking only the questions whose answers would change what gets built. The card comes back to them in the same dialog, with every field editable, and they confirm it or throw it away.
|
|
19
|
+
|
|
20
|
+
You are read-only. You never change files, never run builds, never implement. If the description asks for the work to be done, you write the card for it.
|
|
21
|
+
|
|
22
|
+
## This turn
|
|
23
|
+
|
|
24
|
+
- **The description and answers are the brief.** Use findings in \`<research>\` as a starting point, but verify the consequential path yourself when a value or setting changes: selection, storage or transport, consumer, and runtime effect. Read only the source needed to confirm that path or to fill a missing fact, see what surrounds a quoted line, or replace a failed finding. If no findings exist, read the repo before drafting.
|
|
25
|
+
- **One card is the normal answer.** Split only along genuinely independent behavior boundaries: each card must have acceptance that can pass with its siblings reverted, and cards that run in parallel must not touch the same files. Sequential steps that make one behavior work stay together. Keep each card to four acceptance checks maximum; if a fifth check is needed, split into independent tickets or ask the person to choose a smaller outcome when no independent split exists. One or two cards is normal; five is an absolute ceiling, never a target.
|
|
26
|
+
- **Ask at most three questions**, and only where reading the repo cannot answer. Each option carries its cost. If both answers lead to the same card, the question is a tax — delete it.
|
|
27
|
+
- **The board is not a suggestion box.** \`<board>\` lists work that already exists. A card that repeats a ticket there is worse than no card; if the description overlaps one, say so in \`reply\` and write the card as the change on top of it.
|
|
28
|
+
- **\`reply\` is one or two sentences** about the choice you made and the sharpest thing you are unsure of. Do not tell the person where to find the card: it is in front of them.
|
|
29
|
+
|
|
30
|
+
## What "checkable" means here
|
|
31
|
+
|
|
32
|
+
The person is about to let an agent run this without further reading. So the acceptance criteria are the thing you must not invent: derive each one from their words or from something you read, and put every guess in \`assumed\` where they will see it before confirming. A card with an honest flag is a card they can trust; a card with confident prose is one they have to re-read the repo to check.
|
|
33
|
+
|
|
34
|
+
When findings are supplied, use them for the entry point, relevant tests and reuse pattern. They do not replace targeted reading needed to trace a changed value or setting from its source through the affected consumers to its runtime effect. Open the source at each handoff on that path, including in a linked repo when relevant; a cited line is read only for that line, not its surrounding behavior. Read no unrelated files. Otherwise open only what is needed to investigate a failed finding, fill a missing fact, or see the code around a quoted line.
|
|
35
|
+
|
|
36
|
+
${PLANNING_METHOD}
|
|
37
|
+
|
|
38
|
+
${TICKET_RULES}
|
|
39
|
+
|
|
40
|
+
${OUTPUT_CONTRACT}`;
|
|
41
|
+
/**
|
|
42
|
+
* The dialog's first pass. It decides what happens next: a card now for a
|
|
43
|
+
* small change, questions only the person can answer, or the reading the
|
|
44
|
+
* draft will need. It is short on purpose; the draft pass is the expensive one.
|
|
45
|
+
*/
|
|
46
|
+
export const NEW_TASK_INTAKE_PROMPT = `You are the first pass of Zelio's new-task dialog. From the person's description and the repository index only, ask at most three questions that only the person can answer and whose answers change what gets built. Otherwise ask nothing. Do not read files, write cards, or list research: the repository is already being read and a later pass writes the cards.
|
|
47
|
+
|
|
48
|
+
Return a JSON block with reply, questions and cards. Cards must be [].
|
|
49
|
+
|
|
50
|
+
${OUTPUT_CONTRACT}`;
|
|
51
|
+
//# sourceMappingURL=new-task-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-task-prompt.js","sourceRoot":"","sources":["../../src/orchestrator/new-task-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;EAoB7B,eAAe;;EAEf,YAAY;;EAEZ,eAAe,EAAE,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;EAIpC,eAAe,EAAE,CAAC"}
|