@uchibeke/gallivant 0.0.0-stage → 0.2.1

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.
Files changed (168) hide show
  1. package/CONTRIBUTING.md +26 -0
  2. package/LICENSE +204 -0
  3. package/README.md +239 -2
  4. package/SECURITY.md +19 -0
  5. package/bin/gallivant.mjs +261 -0
  6. package/bin/package-plugin.mjs +16 -0
  7. package/bin/release-live.mjs +29 -0
  8. package/bin/release-package.mjs +23 -0
  9. package/bin/session-runtime.mjs +13 -0
  10. package/bin/task-delivery-state.mjs +12 -0
  11. package/docs/README.md +72 -0
  12. package/docs/agent-setup.md +228 -0
  13. package/docs/app.md +111 -0
  14. package/docs/architecture.md +265 -0
  15. package/docs/chains.md +102 -0
  16. package/docs/codex-cloud.md +284 -0
  17. package/docs/commands.md +649 -0
  18. package/docs/config.md +437 -0
  19. package/docs/execution.md +796 -0
  20. package/docs/guardrails.md +311 -0
  21. package/docs/install.md +398 -0
  22. package/docs/launch.md +45 -0
  23. package/docs/learning.md +369 -0
  24. package/docs/network-recovery.md +101 -0
  25. package/docs/openai-agents.md +457 -0
  26. package/docs/prd.md +246 -0
  27. package/docs/preparation.md +110 -0
  28. package/docs/release-qualification.md +196 -0
  29. package/docs/releasing.md +149 -0
  30. package/docs/runtime-environment.md +113 -0
  31. package/docs/task-delivery.md +476 -0
  32. package/docs/tasks.md +739 -0
  33. package/lib/aport.mjs +95 -0
  34. package/lib/attribution.mjs +95 -0
  35. package/lib/block.mjs +89 -0
  36. package/lib/capabilities.mjs +3 -0
  37. package/lib/chains.mjs +222 -0
  38. package/lib/codex_cloud.mjs +160 -0
  39. package/lib/codex_cloud_config.mjs +20 -0
  40. package/lib/codex_cloud_input.mjs +49 -0
  41. package/lib/codex_cloud_result.mjs +74 -0
  42. package/lib/commands/doctor.mjs +466 -0
  43. package/lib/commands/init.mjs +245 -0
  44. package/lib/commands/learn.mjs +54 -0
  45. package/lib/commands/new.mjs +47 -0
  46. package/lib/commands/ready.mjs +45 -0
  47. package/lib/commands/register.mjs +249 -0
  48. package/lib/commands/resume.mjs +224 -0
  49. package/lib/commands/serve.mjs +349 -0
  50. package/lib/commands/start.mjs +247 -0
  51. package/lib/commands/start_services.mjs +22 -0
  52. package/lib/commands/status.mjs +150 -0
  53. package/lib/commands/task.mjs +73 -0
  54. package/lib/commands/up.mjs +228 -0
  55. package/lib/commands/why.mjs +143 -0
  56. package/lib/config.mjs +461 -0
  57. package/lib/context.mjs +102 -0
  58. package/lib/control.mjs +202 -0
  59. package/lib/control_contract.mjs +16 -0
  60. package/lib/coordinator.mjs +19 -0
  61. package/lib/credential.mjs +161 -0
  62. package/lib/daemon.mjs +156 -0
  63. package/lib/deliverable.mjs +357 -0
  64. package/lib/events.mjs +261 -0
  65. package/lib/executable.mjs +31 -0
  66. package/lib/execution.mjs +707 -0
  67. package/lib/execution_contract.mjs +15 -0
  68. package/lib/execution_input.mjs +4 -0
  69. package/lib/execution_io.mjs +94 -0
  70. package/lib/execution_journal.mjs +69 -0
  71. package/lib/execution_preparation.mjs +29 -0
  72. package/lib/execution_result.mjs +266 -0
  73. package/lib/fs.mjs +140 -0
  74. package/lib/gh.mjs +289 -0
  75. package/lib/git.mjs +434 -0
  76. package/lib/harness.mjs +521 -0
  77. package/lib/harness_log.mjs +432 -0
  78. package/lib/hash.mjs +16 -0
  79. package/lib/identity.mjs +98 -0
  80. package/lib/learning.mjs +654 -0
  81. package/lib/learning_contract.mjs +2 -0
  82. package/lib/learning_data.mjs +135 -0
  83. package/lib/learning_input.mjs +111 -0
  84. package/lib/learning_qualification.mjs +67 -0
  85. package/lib/learning_signer.mjs +151 -0
  86. package/lib/learning_store.mjs +88 -0
  87. package/lib/log.mjs +53 -0
  88. package/lib/network_diagnostics.mjs +64 -0
  89. package/lib/network_recovery.mjs +42 -0
  90. package/lib/notify.mjs +58 -0
  91. package/lib/openai_agents.mjs +373 -0
  92. package/lib/openai_agents_config.mjs +14 -0
  93. package/lib/openai_agents_http.mjs +87 -0
  94. package/lib/openai_agents_input.mjs +15 -0
  95. package/lib/openai_agents_sources.mjs +112 -0
  96. package/lib/owner_delivery.mjs +443 -0
  97. package/lib/plugin_package.mjs +340 -0
  98. package/lib/prd.mjs +635 -0
  99. package/lib/preparation_agents.mjs +33 -0
  100. package/lib/preparation_codex.mjs +212 -0
  101. package/lib/probe.mjs +126 -0
  102. package/lib/prompt.mjs +238 -0
  103. package/lib/provider_health.mjs +55 -0
  104. package/lib/public-format.mjs +31 -0
  105. package/lib/public_output.mjs +49 -0
  106. package/lib/release_package.mjs +154 -0
  107. package/lib/repository_files.mjs +86 -0
  108. package/lib/run.mjs +385 -0
  109. package/lib/run_log.mjs +94 -0
  110. package/lib/runtime-environment.mjs +87 -0
  111. package/lib/runtime_dependencies.mjs +15 -0
  112. package/lib/runtime_node.mjs +107 -0
  113. package/lib/runtime_state.mjs +174 -0
  114. package/lib/sources/index.mjs +27 -0
  115. package/lib/sources/prd.mjs +50 -0
  116. package/lib/start_contract.mjs +37 -0
  117. package/lib/state.mjs +246 -0
  118. package/lib/task_allowance.mjs +31 -0
  119. package/lib/task_completion.mjs +61 -0
  120. package/lib/task_contract.mjs +450 -0
  121. package/lib/task_delivery.mjs +219 -0
  122. package/lib/task_delivery_cancel.mjs +34 -0
  123. package/lib/task_delivery_contract.mjs +61 -0
  124. package/lib/task_delivery_mcp.mjs +40 -0
  125. package/lib/task_delivery_store.mjs +43 -0
  126. package/lib/task_delivery_view.mjs +88 -0
  127. package/lib/task_environment.mjs +281 -0
  128. package/lib/task_prepare.mjs +224 -0
  129. package/lib/task_store.mjs +38 -0
  130. package/lib/tasks.mjs +513 -0
  131. package/lib/tick.mjs +1654 -0
  132. package/lib/time.mjs +36 -0
  133. package/lib/tracker/assets.mjs +43 -0
  134. package/lib/tracker/pages.mjs +320 -0
  135. package/lib/tracker/runs.mjs +102 -0
  136. package/lib/tracker/stream.mjs +74 -0
  137. package/lib/tracker_process.mjs +107 -0
  138. package/lib/verification_sandbox.mjs +181 -0
  139. package/node_modules/smol-toml/LICENSE +24 -0
  140. package/node_modules/smol-toml/README.md +605 -0
  141. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  142. package/node_modules/smol-toml/dist/date.js +156 -0
  143. package/node_modules/smol-toml/dist/error.d.ts +37 -0
  144. package/node_modules/smol-toml/dist/error.js +67 -0
  145. package/node_modules/smol-toml/dist/extract.js +289 -0
  146. package/node_modules/smol-toml/dist/index.cjs +770 -0
  147. package/node_modules/smol-toml/dist/index.d.ts +44 -0
  148. package/node_modules/smol-toml/dist/index.js +34 -0
  149. package/node_modules/smol-toml/dist/parse.d.ts +73 -0
  150. package/node_modules/smol-toml/dist/parse.js +164 -0
  151. package/node_modules/smol-toml/dist/primitive.js +151 -0
  152. package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
  153. package/node_modules/smol-toml/dist/stringify.js +219 -0
  154. package/node_modules/smol-toml/dist/struct.js +156 -0
  155. package/node_modules/smol-toml/dist/util.d.ts +43 -0
  156. package/node_modules/smol-toml/dist/util.js +57 -0
  157. package/node_modules/smol-toml/package.json +68 -0
  158. package/npm-shrinkwrap.json +1823 -0
  159. package/package.json +105 -4
  160. package/templates/claude-settings.json +18 -0
  161. package/templates/passport.gallivant.json +83 -0
  162. package/templates/plugin/bundled-runtime.json +26 -0
  163. package/templates/plugin/schemas/mcp.schema.json +120 -0
  164. package/templates/plugin/schemas/plugin.schema.json +65 -0
  165. package/templates/plugin/task-delivery.SKILL.md +60 -0
  166. package/templates/prd.md +32 -0
  167. package/templates/tracker/tracker.css +301 -0
  168. package/templates/tracker/tracker.js +721 -0
package/docs/tasks.md ADDED
@@ -0,0 +1,739 @@
1
+ # Natural-language tasks
2
+
3
+ Start here when you know the outcome but do not want to hand-write a PRD. The
4
+ output can be code, a research report, documentation or content; it must belong
5
+ to a GitHub repository and have verifiable acceptance criteria. Preparation
6
+ produces the same structured contract used by written briefs.
7
+
8
+ After [setup](install.md), run inside the target checkout:
9
+
10
+ ```sh
11
+ gallivant task "Explain the existing backup and restore commands in docs/operations.md. Change documentation only." \
12
+ --harness codex --verify 'git diff --check'
13
+ ```
14
+
15
+ Inspect the returned draft or answer its questions, then use its printed `Next`
16
+ action to authorize implementation. Add `--run` to the original request when you
17
+ want implementation to start automatically once the brief is ready. This is
18
+ execution authorization, including after clarification answers. It is not a
19
+ merge, deployment or release approval. To open the dashboard after dispatch,
20
+ run `gallivant start` with no PRD path.
21
+
22
+ ## Supported preparation harnesses
23
+
24
+ | Selected harness | Preparation boundary |
25
+ | --- | --- |
26
+ | `claude` | Local restricted mode with tools, MCP and skills disabled |
27
+ | `codex` (0.160.0+) | Local restricted native tool/filesystem capability |
28
+ | `openai-agents` | API text-only session, no environment, tools or delegation |
29
+ | `gemini`, `opencode`, `goose` | No preparation adapter; use a written PRD for implementation |
30
+ | `codex-cloud` | No preparation adapter; new implementation dispatch is also disabled |
31
+
32
+ Use `--harness` explicitly when configuring multiple adapters. Task intake
33
+ otherwise selects the first configured harness. See
34
+ [preparation qualification](preparation.md) and [hosted setup](openai-agents.md).
35
+
36
+ `gallivant task` turns text into an isolated, reviewable PRD. Preparation uses the
37
+ selected harness's configured model and provider settings. This
38
+ can use inference even when you only prepare; it does not start implementation or
39
+ open a pull request without execution authorization.
40
+
41
+ ## Writing requests and publication boundaries
42
+
43
+ This section is a detailed reference for requests that need clarification. For
44
+ a first run, use the example above; for saved drafts, go to
45
+ [inspect, answer and start](#inspect-answer-and-start).
46
+
47
+ For a new request such as “Implement CSV and JSON export, test both, and open one
48
+ pull request for review,” Gallivant preserves the original text and records exact
49
+ source spans assigning only the affirmative publication clause to the coordinator.
50
+ All remaining implementation requirements and prohibitions stay in the provider's
51
+ acceptance criteria. The generated brief's **Coordinator delivery contract** is
52
+ part of both initial approval and ongoing change detection. Its publication
53
+ obligation is fulfilled only by matching canonical repository, PR, base, head and
54
+ completion-gate evidence; a provider statement cannot fulfill it.
55
+
56
+ New ownership contracts also include a same-statement connector such as `, and`,
57
+ `and then` or `then` in the publication span, so it cannot become a dangling
58
+ implementation requirement. Connectors split across lines or containing quoted
59
+ implementation text need clarification. Previously approved contracts keep their
60
+ original spans, criteria and fingerprints on retry; new requests use version five.
61
+ Version five keeps feature metadata and synthetic-object qualifiers within one
62
+ line, so a following line beginning with “title” or “body” cannot hide an earlier
63
+ PR instruction. Saved versions one through four retain their approved feature
64
+ interpretation and exact source spans.
65
+
66
+ This first recognizer supports one unqualified `open/create/raise/submit` review-PR
67
+ clause outside quoted text/code. It is not a general natural-language permission
68
+ parser. Conditional or negated publication clauses, owner approval prerequisites,
69
+ destination qualifiers, multiple PRs and delivery-only requests return
70
+ `TASK_DELIVERY_SCOPE` before inference. Unsupported publication actions also
71
+ require clarification; they never become impossible provider obligations.
72
+ Initial requests and later answers share the same bounded directive checks.
73
+ Local-only, no-push, task-hold or patch-only directions cannot silently fall back
74
+ to the default review-PR workflow. Preference wording such as “I don't want a PR”
75
+ or “We don't need a pull request” also requires clarification.
76
+ Explicit workflow merge or auto-merge requests, and prohibitions on creating
77
+ commits or branches, also return `TASK_DELIVERY_SCOPE` before preparation or a new
78
+ answer is saved. The review-PR workflow needs a branch and commits and grants no
79
+ merge authority. “Do not merge” remains a valid constraint.
80
+ This includes subject-led requests such as “You need to merge it” and passive
81
+ or nominal prohibitions such as “Commits are not allowed” and “Commit creation is
82
+ forbidden.” Compound feature objects such as commit messages and branch reports
83
+ remain implementation requirements.
84
+
85
+ Implementation subjects such as a PR status badge, pull-request template,
86
+ published articles, a publish button, a command to publish docs, local storage,
87
+ commit SHA, diff viewer or branch selection
88
+ remain ordinary requirements. Technical conditions also remain implementation
89
+ scope: `If name is empty, return friend. Open a PR for review.` and the answer
90
+ `Commit the database transaction after validation.` are supported. By contrast,
91
+ `Wait for my approval. Open a PR for review.` requires clarification before work.
92
+ An implementation may consist entirely of a prohibition, such as “Do not log API
93
+ keys in error responses.” That requirement remains in the acceptance criteria.
94
+ Application operations such as publishing events to a message bus, delivering
95
+ notifications, creating user records or merging duplicate contacts also remain
96
+ implementation scope. This distinction applies to initial text and later answers,
97
+ including application-user consent requirements. A technical operation cannot hide
98
+ a later workflow restriction: “Do not deliver notifications twice or create a
99
+ branch” still requires clarification. Quoted examples and merge-button/status
100
+ features do not authorize an actual merge.
101
+ Technical context can also come from a transport (“publish records to Kafka” or
102
+ “deliver reports to S3”),
103
+ repeated delivery (“do not deliver reports twice”) or “delivery of files.” Bare
104
+ commands, Git destinations and restrictions on the task's changes remain workflow
105
+ controls. An unknown noun alone, as in “do not publish the solution,” does not
106
+ override that boundary.
107
+ Destinations apply to their own action: a later report upload cannot qualify an
108
+ earlier restriction on publishing changes. Git metadata used by an application
109
+ operation is distinct from publishing to a Git repository.
110
+ Unrecognized coordinated wording ends destination scope. Shared destinations
111
+ require noun-phrase evidence: determiners, recognized modifiers/compounds or bare
112
+ plural/data nouns. This supports “invoices and tax reports,” “metrics plus traces”
113
+ and “widgets and the gizmo” without enumerating every domain noun. An unknown
114
+ phrase such as “forward reports” is not assumed to be a noun phrase merely because
115
+ its verb is absent from the action vocabulary. For ambiguous application wording,
116
+ state the destination on each action or use separate sentences; direct application
117
+ objects retain an open vocabulary.
118
+ Verb/adjective ambiguities such as “duplicate reports” cannot supply a shared
119
+ destination without a noun marker. Write “metrics and the duplicate reports to
120
+ S3,” or put the destination directly on each application operation.
121
+ The same applies to bare “email,” which can be an action: use “the email” when
122
+ sharing another object's destination, or state its application destination directly.
123
+ Likewise, “log entries” and “download links” can be commands or noun compounds;
124
+ use “the log entries” and “the download links” in shared-destination noun lists.
125
+ These conservative checks apply to new requests and answers. Saved ownership
126
+ contracts retain their approved source spans and interpretation.
127
+ Modifier recognition is intentionally bounded: word endings do not establish a
128
+ noun phrase (for example, “give” and “apply” are verbs). An unfamiliar modifier
129
+ requires a direct application destination instead of a guessed shared scope.
130
+ A later data object cannot qualify a workflow object such as “the solution.”
131
+ Coordinated transfer actions such as “upload reports” or “copy files” start their
132
+ own scope; their destinations cannot qualify an earlier publication prohibition.
133
+ This includes negative leads such as “never upload” and “avoid uploading.” Data
134
+ noun lists such as “metrics plus archived reports,” “the log entries” or “the download
135
+ links” can still share a destination; explicit action leads such as “please
136
+ download links” start a separate action.
137
+ Ordinary leading elisions such as `'90s` and `'tis` remain implementation text even
138
+ when a later possessive apostrophe follows. Use double quotes or backticks to quote
139
+ an entire example beginning with an elision. Saved ownership versions one through
140
+ three keep their original literal interpretation and exact source spans.
141
+ Negative coordination preserves each action's scope: “Do not commit the database
142
+ transaction nor push changes” still forbids delivery. Combining only technical
143
+ operations, such as a database transaction and inserting items into a queue,
144
+ remains implementation scope; `neither … nor …` follows the same distinction.
145
+ Modal forms such as “nor should you push” retain the prohibition too.
146
+ This includes “cannot,” contracted modals such as “can't” or “shouldn't,” and
147
+ permission wording such as “aren't allowed to push.” “In addition to,” “besides,”
148
+ and other supported coordination phrases keep the same action boundary.
149
+ PR quantifiers such as “any,” “more,” “multiple” and numeric counts also retain
150
+ their delivery meaning: “Don't submit any PRs” requires clarification, while
151
+ “Don't submit any PR descriptions” remains an implementation requirement. Only
152
+ the supported affirmative single-PR clause can create a publication obligation.
153
+ Qualifiers such as “GitHub,” “automated” or “experimental” cannot hide that PR
154
+ object. Reference phrases such as “generate a report about the PR” do not request
155
+ PR creation.
156
+ Prohibition forms such as “refrain from opening a PR” and “forbidden from creating
157
+ any PRs” also require clarification. Describing the procedure for opening a PR
158
+ does not itself request publication.
159
+ Active subjects also retain the restriction: “I forbid you from opening a PR” and
160
+ “prevent the agent from opening a PR” require clarification.
161
+ Passive equivalents such as “opening a PR is prohibited/disallowed/banned” do too.
162
+ Explicit merge delegation, including “I require you to merge,” “have the agent
163
+ merge” and “tell the agent to merge,” cannot grant merge authority.
164
+ An incomplete prefix such as “Do not” retains scope across line breaks and blank
165
+ lines. A complete implementation constraint such as “Do not change the API” can
166
+ still precede a separate affirmative PR instruction.
167
+ Multiword qualifiers such as “under any circumstances” or “for any reason” retain
168
+ the same restriction. Nominal prohibitions such as “PR creation is prohibited”
169
+ also require clarification. Application-data merges retain open object names,
170
+ including invoices, database rows, accounts and files; workflow PR/branch objects
171
+ and mixed data/workflow lists remain outside merge authority.
172
+ Bare branches and ref-shaped targets (`main`, `feature/foo`, `origin/main`, Git
173
+ revisions) are workflow merges. Application merges need named data evidence;
174
+ “merge invoices into the main table” retains that application context.
175
+ Explicit Git-qualified single-token operands remain ambiguous even when the token
176
+ is a data word: “merge invoices from tag metadata” requires clarification because
177
+ `metadata` can be a tag name. For application data, name its type explicitly, for
178
+ example “merge invoices with tag metadata records.” “Merge head counts into the
179
+ database” remains an application operation.
180
+ Quantity words do not resolve that ambiguity: “two extra tag names” and “three
181
+ further reference fields” still require clarification. Use an explicit data type,
182
+ such as “two extra tag name records” or “three further reference field records.”
183
+ The same prohibition leads apply to push, commit and branch creation, including
184
+ “refrain from pushing” and “I forbid you from committing.” A negative application
185
+ clause cannot hide a coordinated workflow restriction, as in “do not log keys or
186
+ commit changes”; independent statements and technical conditions retain scope.
187
+ Infinitive complements such as “I forbid the agent to push changes” follow the
188
+ same rule as “forbid the agent from pushing changes.”
189
+ Generating PR titles, bodies, labels and other feature metadata also remains
190
+ implementation scope; those objects do not authorize creating the PR itself.
191
+ Possessive forms such as “the PR's body” and “the pull requests’ titles” follow
192
+ the same rule and retain their exact original text in implementation requirements.
193
+ Hyphenated metadata compounds such as “PR-title” and “pull-request-body” do too.
194
+ PR fixtures and explicitly synthetic representations (such as a mock PR object or
195
+ a normalized PR record, fake PR object or dummy/stub payload) are implementation
196
+ data. Bare PR objects and actual Git commit/branch objects do not gain that exception.
197
+ Local conditions attached to publication are still refused; the parser does not
198
+ guess that a comma or semicolon ended a prohibition or approval requirement.
199
+
200
+ Keep every feature requirement and restriction, and state publication separately
201
+ when needed. Quoted literal labels/code remain implementation data, including
202
+ paired typographic single/double quotes; unmatched typographic quotes do not hide
203
+ instructions. If local-only
204
+ or patch-only output is required, do not authorize this review-PR workflow or
205
+ remove the restriction to bypass clarification.
206
+ Clarify the complete task with the owner and submit it under a new operation ID;
207
+ never delete a condition just to pass validation. Answers may refine implementation
208
+ but cannot silently replace publication ownership or add a publication prerequisite.
209
+ This applies to explicit publication clauses, the default review workflow and new
210
+ answers to older saved tasks without completion metadata. Exact previously
211
+ accepted answer retries still replay their saved receipt. There is no typed
212
+ delivery-amendment operation yet. The supported answer boundary
213
+ conservatively refuses recognized lifecycle/artifact language; it does not claim
214
+ to understand every possible paraphrase. Review the complete saved owner contract
215
+ before authorizing implementation, and clarify conflicting delivery intent instead
216
+ of treating a model's interpretation as permission.
217
+ Selecting `integrated` still grants no merge authority. Existing saved tasks,
218
+ approved criteria, false attestations and exact operation retries retain their
219
+ original semantics; this change does not repair historical results.
220
+
221
+ ## Repository context and preparation
222
+
223
+ Preparation uses a capability on the selected harness adapter, through the same
224
+ execution service for drafting, questions and repairs. Gallivant owns deterministic
225
+ validation/readiness and explicit implementation authorization. The examples
226
+ select Claude; `--harness codex` uses Codex
227
+ 0.160.0 or newer. Claude removes its tools. Codex removes external and execution
228
+ tools and uses a filesystem profile that grants no project or credential access
229
+ to any remaining tool. Only the bounded context in the prompt is available.
230
+ Model/provider defaults remain selected. `openai-agents` uses the text-only API
231
+ boundary described above and retains its explicit account/model. Gemini,
232
+ OpenCode, Goose and Codex Cloud return
233
+ `TASK_PREPARATION_BOUNDARY` until their preparation capability is implemented;
234
+ there is no automatic fallback. See [qualification](preparation.md).
235
+
236
+ ```sh
237
+ gallivant task "Add CSV export for the widget table. Do not add dependencies." \
238
+ --dir /path/to/checkout --repo owner/repo --base main --harness claude \
239
+ --context docs/export-plan.md --request-id export-2026-10 --json
240
+ cat request.txt | gallivant task --stdin --dir /path/to/checkout --harness claude --json
241
+ ```
242
+
243
+ The repository resolves from the checkout using the existing Git/GitHub helpers.
244
+ `--repo` asserts its identity; it must match that checkout. Base precedence is the
245
+ usual explicit flag, repository configuration, then default branch. Harness
246
+ selection uses the explicit flag or the first configured harness, as `new` does.
247
+ Use an explicit selection when several adapters are configured.
248
+ Selected context consists of explicit repository files. Root `AGENTS.md`, common
249
+ build manifests, supported text lockfiles and instructions above selected files
250
+ are included automatically. Package-script inference uses `packageManager` first,
251
+ then an unambiguous `package-lock.json`, `npm-shrinkwrap.json`, `pnpm-lock.yaml`,
252
+ `yarn.lock` or `bun.lock`. It does not default to npm. Missing, unsupported or
253
+ conflicting manager evidence is exposed in `commandIssues` for clarification;
254
+ answer with an explicit `--verify` command or selected manager context. Binary
255
+ lockfiles are outside the text context contract; supply a supported manifest
256
+ setting or explicit check. Selecting a nested `package.json` also snapshots
257
+ supported text lockfiles beside it. Automatic lockfiles use the same path and
258
+ combined byte limit as other selected files, including at answer time.
259
+ Context is bounded to 256 KiB and requests to 32 KiB; choose fewer files if needed.
260
+ The service also measures the smallest possible canonical brief using the checker's
261
+ 1,500-word limit and the actual JSON quoting rules. Owner fragments must appear in
262
+ the mapping and executable criteria, with at least one story. If that minimum
263
+ already exceeds the limit, `TASK_INPUT` asks for a smaller request before repository
264
+ lookup or a preparation turn. The same check includes accumulated answers before
265
+ reading new context or changing the accepted revision or answer-operation identity;
266
+ a shorter corrected answer can reuse the refused operation identity. Raw whitespace
267
+ word counts alone are insufficient because JSON quoting escapes tabs. Recovery
268
+ settles any already-owned preparation turn and preserves usage before stopping
269
+ oversized saved state; it launches no further planning or repair turn.
270
+ An intake accepts at most 128 immutable requirement fragments across nonblank
271
+ request and answer lines, matching its mapping capacity. Oversize requests stop
272
+ before repository lookup or preparation. An answer that exceeds the remaining
273
+ capacity is rejected before context reads or state changes; its operation ID and
274
+ revision remain available for a corrected reply. Prepare a smaller intake if
275
+ the remaining material questions cannot fit. Existing owned turns are reconciled
276
+ with usage retained before oversized legacy state stops without a new turn.
277
+ The complete serialized preparation prompt is also limited to 120 KiB, including
278
+ JSON escaping, runtime instructions, saved answers, previous output and repair
279
+ feedback. This portable limit is checked before a harness probe or launch on every
280
+ new turn. Oversize input stops with an actionable failure and keeps the saved
281
+ requirements, without truncation, a launch intent or another model call. Prepare
282
+ a smaller intake with fewer or smaller documents; blocked intakes do not retry
283
+ automatically. Reopening an already launched turn reconciles that run as usual.
284
+ Preparation receives these documents in its prompt and does not inherit global
285
+ `context_paths` read grants. Its child environment admits process basics and the
286
+ selected adapter's explicit provider authentication/settings allowlist, defined
287
+ in `lib/harness.mjs`, with cloud-mode additions in `lib/task_environment.mjs`.
288
+ Unrelated tokens, database URLs, other adapters' keys and
289
+ shell startup overrides are excluded. Preparation has a private `HOME`, XDG roots
290
+ and temporary directory. The selected adapter's native auth/config files and
291
+ configured resource directories are copied into private snapshots, so parent
292
+ traversal and preparation writes
293
+ cannot reach native files through those entries. A selected entry itself must be
294
+ a regular file or directory: even an internal or broken top-level symlink is
295
+ refused before launch. Replace that entry with the intended provider file or
296
+ directory. Links inside a selected resource directory are materialized; links
297
+ outside that directory, cycles, broken links and special files stop preparation
298
+ before launch and remove partial copies. Previous
299
+ sessions and unrelated home-directory credentials are excluded. AWS authentication
300
+ requires Bedrock selection. Claude preparation resolves exactly one enabled
301
+ `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX` or `CLAUDE_CODE_USE_FOUNDRY`
302
+ flag before carrying authentication. The string values `1`, `true`, `yes` and `on`
303
+ enable a mode, ignoring case; `0`, `false`, `no`, `off` and empty values disable it.
304
+ With a cloud mode enabled, direct `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`,
305
+ `CLAUDE_CODE_OAUTH_TOKEN`, `.credentials.json` and `.claude.json` login state are
306
+ excluded. With all modes disabled, direct authentication remains available.
307
+ Rebuilding clears prior private Claude login and cloud authentication copies,
308
+ including when mode selection fails. Native files retain their contents.
309
+ Conflicting or unsupported flag values stop with `TASK_PREPARATION_ENV` before
310
+ launch; keep the configured provider and export one unambiguous selection.
311
+ Claude settings are strict JSON. Provider selectors or authentication variables
312
+ in their `env` block also stop preparation because native settings can override
313
+ the shell selection. Export those configured values and use a dedicated
314
+ `CLAUDE_CONFIG_DIR` profile without such overrides; model and permission settings
315
+ remain in the copied file. See the
316
+ [Claude environment reference](https://code.claude.com/docs/en/env-vars) and
317
+ [settings reference](https://code.claude.com/docs/en/settings).
318
+ For Goose, `GOOSE_PROVIDER` overrides the copied native
319
+ `config.yaml` selection; otherwise preparation reads `active_provider`, falling
320
+ back to legacy `GOOSE_PROVIDER`. Plain or quoted provider names retain their
321
+ selected model and configuration bytes. Complex or ambiguous YAML selectors stop
322
+ before launch with guidance to set `GOOSE_PROVIDER` explicitly to the native
323
+ provider; preparation never guesses or switches providers. Rebuilding a private
324
+ turn removes earlier AWS snapshots even when the new selection is another
325
+ provider or cannot be resolved. See the
326
+ [Goose configuration reference](https://github.com/aaif-goose/goose/blob/main/documentation/docs/guides/config-files.md).
327
+ Preparation projects only `AWS_PROFILE`
328
+ (or `default`) from the shared config and credentials files, including files
329
+ selected through `AWS_CONFIG_FILE` and `AWS_SHARED_CREDENTIALS_FILE`. Other
330
+ profiles, comments, caches and unrelated files are excluded. Complete selected
331
+ file credentials also exclude overridden config credentials. Complete environment
332
+ credentials or explicit web identity omit native file credentials; an environment
333
+ region also avoids reading unused ambient configuration. Named profiles resolve
334
+ the same explicit environment identity in SDKs that prioritize profile lookup.
335
+ Private files use mode `0600`, and rebuilding removes earlier shared snapshots.
336
+ Flat static profiles and supported region/retry settings retain their values;
337
+ credential chains, SSO/cache dependencies, ambiguous sections or unsupported
338
+ settings stop before launch without automatic retry. Export scoped temporary
339
+ `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` credentials and `AWS_REGION`, or select
340
+ a dedicated static profile through the AWS file settings. See the
341
+ [AWS shared-file format](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html).
342
+ Claude's explicit Vertex mode can also use
343
+ native Google credentials. Gemini with `GOOGLE_GENAI_USE_VERTEXAI=true` carries
344
+ only `gcloud/application_default_credentials.json` into its private config root.
345
+ Claude's enabled Foundry mode forwards only its configured
346
+ `ANTHROPIC_FOUNDRY_RESOURCE`, `ANTHROPIC_FOUNDRY_BASE_URL`,
347
+ `ANTHROPIC_FOUNDRY_API_KEY` and `ANTHROPIC_FOUNDRY_AUTH_TOKEN` values, retaining
348
+ native endpoint/authentication precedence and the selected model. These values
349
+ are excluded when Foundry is off or another adapter is selected. Azure CLI caches
350
+ and unrelated Azure credentials remain excluded; supply an explicit Foundry key
351
+ or bearer token if authentication otherwise needs those native files. See the
352
+ [Claude Foundry settings](https://code.claude.com/docs/en/microsoft-foundry).
353
+ Explicit `GOOGLE_APPLICATION_CREDENTIALS`, AWS web-identity token files and
354
+ `OPENCODE_CONFIG` also point to private copies, retaining the selected contents
355
+ and authentication precedence. Refreshes and edits stay in the preparation turn.
356
+ Relative provider file and profile paths use the original invocation directory,
357
+ saved as `callerCwd`, even when `--dir` selects another checkout. Repairs, retries
358
+ and resumed answers keep that directory. Older version-1 intake records without
359
+ it use their saved checkout; a missing selected file stops before launch.
360
+ Model and provider selections are preserved. Preparation uses a separate tool
361
+ contract; implementation argv, permissions and defaults retain their behavior.
362
+
363
+ `GH_CONFIG_DIR=/dev/null` disables stored GitHub CLI credentials. The existing Git
364
+ environment disables user/system configuration; inherited Git/SSH overrides,
365
+ askpass programs, agent sockets, terminal prompts and Git transports are disabled.
366
+ Credential separation does not add an OS sandbox. Preparation currently supports
367
+ Claude with restricted mode, an empty built-in tool set, denial of every tool,
368
+ an empty strict MCP configuration and disabled skills/commands. Selected context
369
+ is already in the prompt, so planning needs no file, shell or network tools.
370
+ Codex uses the restricted native capability described in [preparation](preparation.md).
371
+ These local environment/profile details do not describe hosted preparation:
372
+ `openai-agents` uses its selected API account and a text-only remote session,
373
+ without a host credential profile or workspace.
374
+ Gemini, OpenCode and Goose preparation return
375
+ `TASK_PREPARATION_BOUNDARY` before probes, profile copying or model launch because
376
+ their current adapters have no established preparation read/write boundary or
377
+ tool-free contract. There is no automatic harness, model or provider fallback.
378
+ Use a hand-authored PRD with the existing `ready`/`start` path until an enforced
379
+ preparation adapter is supported. Native Codex boundary qualification uses an
380
+ installed CLI against a local provider fixture; live inference and installed
381
+ ChatGPT workflow qualification remain separate checks.
382
+
383
+ Attempts record their preparation boundary. Recovery stops an owned legacy
384
+ tool-enabled child and preserves its usage/logs; completed, settled and previously
385
+ rendered output without that boundary cannot authorize readiness or dispatch.
386
+ Existing implementation runs continue through their original ownership path.
387
+
388
+ Goose environment snapshots resolve `GOOSE_PROVIDER` first, then the native
389
+ current/legacy selector. Only that provider's environment authentication/settings
390
+ are admitted; Bedrock keeps the selected AWS projection. Shared `secrets.yaml`
391
+ and keyring access are excluded, including old private snapshots. Export the
392
+ selected provider's credential when it otherwise lives in shared secret storage;
393
+ missing/unsupported selectors are refused instead of forwarding every provider.
394
+ An unsupported provider environment variable is not forwarded implicitly: use
395
+ the selected harness's native auth/config profile. Profile failures stop before a
396
+ model launch and return an actionable failure; they are not validator repairs.
397
+ Permission denials also stop preparation, including when the harness exits zero.
398
+ The result and saved attempt retain the denied calls and any guardrail reasons
399
+ recorded by the adapter, alongside provider errors and the run-log path. Reopening
400
+ or recovering that failed attempt preserves the report without another planning
401
+ turn, readiness decision or implementation dispatch.
402
+
403
+ ## Choose the delivery milestone
404
+
405
+ Select the target when preparing a task, using `--completion-target integrated`
406
+ or the structured `completion: { target: 'integrated' }` field. Omission selects
407
+ `delivery_ready`. Capability discovery supplies supported targets and labels;
408
+ clients should render those choices instead of maintaining a separate list.
409
+ The target is immutable for a saved request. Changed retry input conflicts.
410
+
411
+ `delivery_ready` is fulfilled when the current pull request passes Gallivant's
412
+ existing checks, reviewer and completion gate and its owned execution is settled.
413
+ The saved execution ledger is checked even when the task registry has not caught
414
+ up; pending collection keeps the target pending. Automatic observation and fixing
415
+ then stop at that saved handoff; later review comments do not authorize more work.
416
+ An explicit existing recheck/resume control reopens the normal workflow.
417
+ `integrated` keeps the existing coordinator watching that qualified delivery until
418
+ GitHub reports it merged. Neither choice grants permission to merge, release or
419
+ deploy. While monitoring, a new head or blocking feedback uses the existing review
420
+ loop; no parallel runner is created.
421
+ Closing without merging is blocked. An early merge, stale receipt/head/base,
422
+ missing merge proof or changed checks/review is unverified, not fulfilled.
423
+ Cancellation keeps its existing authority and stops further dispatch.
424
+
425
+ Saved results include `completion.target`, `status`, `reason`, `monitoring` and
426
+ `evidence`. Delivery evidence records the exact head, base, receipt hash, check
427
+ count, reviewer verdict and completion-gate source/decision ID. Integration
428
+ records GitHub's observed head, merge commit and timestamps. It is observational
429
+ evidence, not a provider's self-report or a newly signed completion credential.
430
+ Legacy tasks retain their workflow behavior and receive no invented evidence.
431
+ A skipped completion gate cannot claim a fulfilled target.
432
+ A qualified, stopped handoff can release its artifact pin for a compatible idle
433
+ runtime update. Pending controls, live/uncollected execution, unresolved receipts,
434
+ intake or chains still block migration independently; evidence and saved intent
435
+ are preserved without rewriting the historical workflow state.
436
+
437
+ Keep implementation acceptance separate from coordinator publication. For example,
438
+ a host can prepare a greeting change with the complete behavior, native Node test,
439
+ README and scope constraints in `text`, plus `completion: { target: 'delivery_ready' }`
440
+ for the pull-request lifecycle. A chat host should organize the owner's prose and
441
+ show the complete brief and selected target for review; the owner need not learn a
442
+ special input format. Preserve explicit prohibitions such as no merge, release,
443
+ workflow edits, new dependencies or access to other repositories. The target never
444
+ overrides those constraints.
445
+
446
+ New completion-aware drafts consolidate criteria with identical requirement
447
+ coverage, preserving all immutable owner fragments and their mappings. Existing
448
+ approved drafts and false attestations are never rewritten. Only supported
449
+ affirmative publication clauses can be separated from mixed
450
+ implementation/publication text. A host must clarify unsupported or ambiguous
451
+ ownership rather than silently drop a requirement. The generated
452
+ Delivery target section explains which milestones the coordinator observes.
453
+
454
+ ## Inspect, answer and start
455
+
456
+ The result includes contract `version: 1`, a durable `taskId`, a state `revision`,
457
+ original input, requirements, answers, assumptions, requirement mapping, draft
458
+ path/text/hash, source hashes, readiness evidence, preparation usage, artifacts and
459
+ the next action. `stories` contains sequential `us-N` IDs, story text and the
460
+ authorized requirement IDs associated with each story. `verifyCommands` lists
461
+ candidate commands and their authorizing
462
+ source paths, while `commandIssues` explains withheld package-script inference.
463
+ `inspect` and `list` read saved state without inference or remote
464
+ polling. Implementation results also expose the existing registry's state and PR
465
+ link, so reopening an intake does not lose access to the eventual result.
466
+
467
+ ```sh
468
+ gallivant task inspect task-0123456789abcdef01234567 --json
469
+ gallivant task list --json
470
+ gallivant task answer task-0123456789abcdef01234567 --revision 2 \
471
+ --request-id format-answer --answer 'q-r-1=Use CSV only; JSON is excluded.' \
472
+ --context docs/export-format.md --json
473
+ gallivant task validate task-0123456789abcdef01234567 --revision 4 --json
474
+ gallivant task start task-0123456789abcdef01234567 --revision 4 --run --json
475
+ ```
476
+
477
+ Use the revision and question identifiers returned by your own result. Commands
478
+ never wait for a terminal question. Missing or conflicting requirements return
479
+ `needs-input`; each answer is attached to its existing task. Piped stdin must finish
480
+ within five seconds. `--answer`, `--context` and `--verify` may repeat. Context can
481
+ be supplied during preparation or while answering questions. Answer-time files
482
+ and their instructions use the same path checks and combined context size limit;
483
+ their pinned bytes reach the resumed planner and generated source snapshots.
484
+ Existing context remains pinned. Explicit reselection of changed accepted bytes
485
+ returns a conflict. Duplicate answer identities replay without rereading files;
486
+ changing their selected paths conflicts. Other CLI task operations reject
487
+ `--context`. For a stack
488
+ without discoverable test commands, answer the material question and supply the
489
+ exact repository command using `--verify 'python -m unittest'`.
490
+
491
+ `--run` on preparation persists execution authorization through questions and
492
+ answers. Once the exact generated brief and source snapshot pass readiness, the
493
+ service starts it once and brings up the normal daemon. No second confirmation is
494
+ needed. If the process exits after saving readiness but before dispatch, retrying
495
+ the same preparation request or answer identity resumes that saved authorization
496
+ through the exact approval and dispatch-ownership checks. A preparation-only
497
+ retry still returns the draft without implementation.
498
+ Preparation without `--run` returns the draft and an explicit next action.
499
+ `--no-daemon` leaves monitoring to an explicitly started `gallivant up`.
500
+
501
+ Readiness uses the existing PRD checker and readiness decision procedure. It proves
502
+ contract structure, not semantic correctness or passing implementation tests.
503
+ Review the assumptions and mapping. All nonblank request lines are immutable
504
+ requirement fragments; their exact text is attached to mapped criteria or shown as
505
+ unresolved. An explicit answer can clarify a previously questioned fragment; the
506
+ mapping records which answer resolved it. Saved question ownership determines the
507
+ clarification even when the planner omits `resolvedBy`. All applicable answers
508
+ remain quoted in accepted order, and later answers govern conflicts with earlier
509
+ ones. Earlier answer fragments retain that precedence too, so they cannot become
510
+ standalone demands for a superseded outcome. A follow-up question about an earlier
511
+ answer fragment carries its proven original question ownership forward; unrelated
512
+ requirements retain their original scope. Repairs cannot quietly omit a fragment.
513
+ Every acceptance criterion must also appear in a requirement mapping; selected
514
+ context alone cannot authorize additional implementation scope. Unmapped criteria
515
+ trigger bounded repair, and saved drafts with them cannot validate or start.
516
+ Each planner story must include a nonempty, duplicate-free list of authorized
517
+ requirement IDs. Those links appear in the generated brief and structured result.
518
+ Links organize requirements; they do not approve planner-written behavior. The
519
+ service replaces every story and criterion's prose with a deterministic wrapper
520
+ and exact, JSON-quoted owner fragments. For a validated clarification, it quotes
521
+ both the original fragment and the saved answer, with the answer governing
522
+ conflicting parts; the original also remains in the requirements mapping.
523
+ A falsely linked deployment outcome therefore never becomes
524
+ an executable criterion or story. Owner-requested deployment remains intact.
525
+ Generated rationale, assumptions, locations and exclusions are advisory and cannot
526
+ add to or override this scope. Material ambiguity still requires an owner answer;
527
+ the wrapper does not claim to resolve it or prove semantic correctness.
528
+ Unlinked stories, unknown IDs and older string-only stories trigger repair on new
529
+ turns and fail saved validation or dispatch. Inspect an older brief and prepare a
530
+ new intake to establish its story ownership; no authorization is inferred from
531
+ untrusted context. Saved validation recomputes the same owner-derived body, so an
532
+ older draft containing planner-written executable scope cannot dispatch even if
533
+ its recorded hash and readiness digest match. Existing owned implementation runs
534
+ still reconcile without a duplicate launch. No extra confirmation is added to
535
+ already authorized `--run` work.
536
+ Each question's requirement IDs must exactly match its unresolved mappings, with
537
+ no duplicate IDs. Saved ownership limits which fragments an answer can clarify.
538
+ Reopening an older unanswered question proves ownership from its saved mappings;
539
+ inconsistent claims or missing ownership for an already answered question stop
540
+ instead of granting broader clarification. Inspect the saved evidence and prepare
541
+ a new intake if that association cannot be recovered.
542
+ Quoted fragments use reversible JSON Unicode escapes for literal placeholder
543
+ tokens, so requests such as “remove the TODO” can pass readiness. The saved request
544
+ and answers keep their original text; generated prose and hand-authored briefs
545
+ still pass the same placeholder check.
546
+ An older draft while partial answers are pending has `draft.current: false`.
547
+
548
+ Preparation stays under `$GALLIVANT_HOME/tasks/<task-id>/`: private intake state,
549
+ isolated turn directories and immutable draft revisions. Runner logs and jobs use
550
+ the normal per-run layout with a separate `intake/<task-id>` identity. Generated
551
+ source paths must be selected documents. The existing `sources` gate validates
552
+ them and `start` delivers pinned bytes to the implementation checkout, including
553
+ documents that exist only in the operator tree. Symlinks, escapes, globs, control
554
+ characters and secret/agent configuration paths are refused by intake. Existing
555
+ hand-authored PRDs retain their source-manifest rules. Editing the original
556
+ source after approval does not silently change the selected snapshot.
557
+ Task source paths beginning or ending with a single or double quote are refused
558
+ before planning or answer writes, because the existing frontmatter parser cannot
559
+ preserve those boundary characters. Rename the file or select another path.
560
+ Quotes inside a path remain supported. Generated and saved source manifests use
561
+ the same task-specific guard; hand-authored source parsing is unchanged.
562
+ Task source paths with leading or trailing whitespace are also refused before
563
+ the shared parser can trim them into a different filename. Raw selections are
564
+ checked before request or answer identity replay, without rereading accepted
565
+ files. Rename the file or select a different path. Internal spaces, including
566
+ spaces inside directory names, retain their exact identity and selected bytes.
567
+ Inferred Verify commands require their pinned authorizing manifests or instruction
568
+ files in the generated `sources`. Repair may add these selected files; it cannot
569
+ silently drop the dependency. The existing start path delivers their exact bytes
570
+ to the fresh base checkout, including scripts present only in an operator's dirty
571
+ or feature checkout. Commands explicitly supplied by the owner without inferred
572
+ repository evidence remain explicit choices; a duplicate explicit command cannot
573
+ bypass a known source dependency. Commands with extra arguments also carry their
574
+ selected stack manifest. Saved drafts are checked against the same rule.
575
+ Explicit project overrides such as
576
+ `--verify 'npm test --prefix packages/app' --context packages/app/package.json`
577
+ carry every selected `package.json` and matching manager lockfile, including nested
578
+ paths. This also covers flags before the action and pnpm, Yarn and Bun owner
579
+ commands. Selecting a subproject does not infer argument-bearing commands or
580
+ replace root package-manager evidence. The same tool-family rule binds selected
581
+ Go, Cargo, Make and pytest manifests at any repository depth. It preserves the
582
+ existing Maven/.NET behavior without interpreting arbitrary shell syntax.
583
+ See the [npm prefix configuration](https://docs.npmjs.com/cli/v11/using-npm/config/).
584
+ Matching text lockfiles also remain pinned and carried, so a fresh base receives
585
+ the evidence used to select its manager. Automatically inferred instruction
586
+ commands must name test, lint, check or typecheck actions; publishing, deployment,
587
+ release targets, paid/live checks and composed shell commands are not candidates.
588
+ Instruction inference accepts canonical invocations without extra arguments:
589
+ package-manager test/check scripts, named Make checks, `go test ./...`, `cargo test`,
590
+ `python -m pytest` / `pytest`, and `git diff --check`. Runner flags, plugin loading,
591
+ project overrides, output paths and even benign extra flags require explicit
592
+ owner selection with `--verify`, including on an answer. Their supporting
593
+ manifests still need to be selected and carried. Legacy cached candidates are
594
+ rechecked before readiness and dispatch under the same restriction.
595
+ Maven and .NET commands are not inferred from instructions because their project
596
+ manifests do not yet have automatic snapshot support. Supply the repository's
597
+ check with `--verify 'mvn test'` or `--verify 'dotnet test'` and explicitly select
598
+ its supporting manifests with `--context`; those owner choices remain available
599
+ during preparation and answers. Explicit Maven commands must carry every selected
600
+ `pom.xml`, including parent and module POMs. Explicit `dotnet test` commands must
601
+ carry selected `.sln`, `.slnx`, `.csproj`, `.fsproj` and `.vbproj` files. The same
602
+ provenance rule applies to answers, repairs and saved-draft validation before
603
+ start, so a fresh base receives the selected manifest bytes. Checks without
604
+ selected project files remain explicit owner choices. See the
605
+ [Maven POM documentation](https://maven.apache.org/guides/introduction/introduction-to-the-pom.html)
606
+ and [.NET test command reference](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test-vstest).
607
+ Known manifest scripts and established manager selection take precedence over
608
+ unrelated instruction snippets. The service records explicit owner commands
609
+ separately from inferred candidates. Reopening an older record rebuilds inference
610
+ and rechecks saved drafts; a cached command alone does not prove owner selection.
611
+ If an older explicit choice cannot be recovered, prepare a new intake with it.
612
+
613
+ At most three validator repairs occur, across the entire intake, and at most 16
614
+ preparation turns including clarification turns. They share the configured
615
+ preparation budget and cumulative runtime allowance. Reported costs and usage are
616
+ recorded per turn; unavailable costs stay `null`. The spend cap is enforced by
617
+ harnesses that support it, while others have turn/runtime bounds and cannot promise
618
+ a hard dollar cap. A provider error, tool denial, exhausted allowance, unresolved
619
+ dispatch or readiness denial stops visibly. A blocked intake is not automatically
620
+ retried or assigned to a different provider.
621
+ Recovered completion must also fit its persisted deadline. A known completion
622
+ before the deadline remains usable even if reopened later; a completion after it
623
+ is refused with its usage and log evidence retained. If the coordinator missed
624
+ the exit and no end time exists, runner settlement time is a conservative bound.
625
+ An over-budget saved-output replay cannot become a pass or another repair turn.
626
+
627
+ Use `task resume <id> --revision <n>` to reconcile interrupted preparation or finish
628
+ an already authorized, ready intake.
629
+
630
+ An explicit resume also retries a remote preflight deadline when the saved record
631
+ proves it happened before submission. It preserves the task, requirements,
632
+ allowance and previous settled attempts. The retry reruns provider authorization
633
+ and the normal preparation boundary. A bare legacy timeout, uncertain dispatch,
634
+ policy refusal, exhausted allowance or malformed output does not grant this retry.
635
+ Those records remain blocked or reconcile their already-owned provider operation.
636
+
637
+ The portable `prepare` and `answer` operations accept optional `verifyCommands`
638
+ (up to 32 commands, each up to 500 characters). These are explicit owner
639
+ selections, passed through the same supported-command and source checks as the
640
+ CLI. Writing a command in an answer does not itself select executable authority.
641
+ Selections are part of the operation identity; changing them requires a new
642
+ operation on the current task revision. Preparation progress in delivery views
643
+ uses the saved preparation attempt until implementation owns a run.
644
+
645
+ `task validate` returns `TASK_NOT_READY` while preparation is incomplete, even if
646
+ an older question-bearing draft exists. It leaves the saved revision, accepted
647
+ answers and owned run unchanged; resume preparation with the current revision
648
+ before validating. Resume reconciles that run and retains its usage and deadline
649
+ checks without purchasing a replacement turn.
650
+
651
+ Request identities deduplicate preparation; reusing one for different inputs
652
+ conflicts. Answer operation identities deduplicate replies. Every mutation checks
653
+ the expected state revision.
654
+ Answer operation IDs, including `__proto__`, are persisted as own dictionary keys
655
+ and replay after restart; an unknown question ID is refused without dropping it
656
+ from CLI input or changing the accepted state.
657
+ Missing launch acknowledgements reconcile the recorded job; uncertain
658
+ implementation acceptance retains its start claim/intent and requires inspection
659
+ rather than another launch.
660
+ For a known preflight failure before cloning (for example missing GitHub credentials,
661
+ a stale worktree refused before the clone command, a parent-path conflict, or clone
662
+ environment resolution failure),
663
+ fix its cause and explicitly call `task start` with the saved current revision.
664
+ The shared start claim and intake dispatch intent are released only when the
665
+ creator confirms that no clone executor was invoked. Stale operator files are
666
+ preserved for inspection; the refusal never deletes them. Existing run authorization,
667
+ requirements and approved snapshots are retained. Once cloning is attempted, the shared
668
+ start claim records the planned worktree, branch and base and survives clone,
669
+ source-delivery or later pre-spawn failures. `dispatchRecovery` exposes that clone
670
+ in structured results and CLI output points to it. Inspect the retained clone,
671
+ snapshots, claim and any runner job before recovery; ordinary retry never clears
672
+ that ownership, deletes the checkout or attempts another clone. A possible spawn
673
+ is also never cleared this way. Hand-authored starts and chains share the same
674
+ ownership boundary.
675
+ After implementation starts, use the existing `status`, `why`, tracker controls and
676
+ `resume --resnapshot` flow for accepted contract changes. The daemon stops at its
677
+ usual human-review and configured limit boundaries; it never merges automatically.
678
+
679
+ ## Structured clients
680
+
681
+ These exports are local, trusted, in-process operations. The implemented
682
+ [task-delivery dispatcher and MCP integration](task-delivery.md) add scoped
683
+ account/repository authorization for host applications. The task module by itself
684
+ is not an authenticated public server.
685
+ Importing it reads no user configuration and starts no daemon or network work.
686
+ Creating the usual context is an explicit caller action.
687
+
688
+ ```js
689
+ import { createTaskService, TASK_VERSION } from '@uchibeke/gallivant/tasks';
690
+ import { makeContext } from '@uchibeke/gallivant/context';
691
+
692
+ const tasks = createTaskService(makeContext());
693
+ let result = await tasks.prepare({
694
+ text: 'Export widgets to CSV. Do not add dependencies.',
695
+ dir: '/path/to/checkout', repo: 'owner/repo', base: 'main',
696
+ harness: 'claude', context: ['docs/export-plan.md'],
697
+ requestId: 'export-2026-10', run: false,
698
+ });
699
+ if (result.status === 'needs-input') {
700
+ result = await tasks.answer({
701
+ taskId: result.taskId, expectedRevision: result.revision,
702
+ operationId: 'format-answer',
703
+ answers: { [result.questions[0].id]: 'Use CSV only.' },
704
+ context: ['docs/export-format.md'],
705
+ });
706
+ }
707
+ if (result.status === 'ready') {
708
+ result = await tasks.validate({ taskId: result.taskId, expectedRevision: result.revision });
709
+ if (result.status === 'ready' && result.readiness?.allow) {
710
+ result = await tasks.start({ taskId: result.taskId, expectedRevision: result.revision, run: true });
711
+ }
712
+ }
713
+ console.log(TASK_VERSION, tasks.inspect({ taskId: result.taskId }));
714
+ ```
715
+
716
+ `prepare`, `answer`, `resume`, `validate` and `start` return promises. `inspect` and
717
+ `list` are synchronous. Failures carry `version`, `code` and `message`; CLI `--json`
718
+ renders `{version: 1, error: {code, message}}`. A `TASK_CONFLICT` requires inspecting
719
+ the current revision, not overwriting it. Persist `taskId` and operation identities
720
+ when a caller loses a response.
721
+
722
+ ## Validation and live evidence
723
+
724
+ ```sh
725
+ npm test
726
+ npm run lint
727
+ npm run test:task-intake
728
+ git diff --check
729
+ ```
730
+
731
+ These commands are deterministic and do not call models. The focused suite covers
732
+ clear/ambiguous/conflicting input, hostile context, repair preservation, real
733
+ readiness denials, stale revisions, duplicate/uncertain dispatch, source delivery,
734
+ runner usage, stdin bounds and clean installed-package imports/help.
735
+
736
+ See [the evidence index](https://github.com/uchibeke/gallivant/blob/main/docs/audit/plugin-ready/README.md) for the separate G8 live
737
+ prerequisites, unavailable attestations and bounded qualification procedure.
738
+
739
+ Direct task-service mutations acquire the namespace task-mutation owner through all asynchronous effects and release it on success or failure. They refuse artifact-pinned homes; those homes use the manifest-aware delivery adapter. CLI and delivery adapters borrow their existing live owner, checked against the same namespace, while inspect/list stay read-only.