@codetreker/daynight 0.13.1 → 0.17.2

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 (36) hide show
  1. package/dist/api/client.d.ts +10 -6
  2. package/dist/api/client.js +77 -16
  3. package/dist/api/client.js.map +1 -1
  4. package/dist/api/parse.js +39 -8
  5. package/dist/api/parse.js.map +1 -1
  6. package/dist/api/types.d.ts +86 -5
  7. package/dist/commands/skill/refresh-installed.d.ts +1 -0
  8. package/dist/commands/skill/refresh-installed.js +17 -0
  9. package/dist/commands/skill/refresh-installed.js.map +1 -0
  10. package/dist/commands/skill/refresh.d.ts +4 -0
  11. package/dist/commands/skill/refresh.js +87 -0
  12. package/dist/commands/skill/refresh.js.map +1 -0
  13. package/dist/commands/skill/skills/using-daynight/SKILL.md +23 -16
  14. package/dist/commands/skill/skills/using-daynight/references/autopilot.md +69 -48
  15. package/dist/commands/skill/skills/using-daynight/references/create-task.md +25 -18
  16. package/dist/commands/skill/skills/using-daynight/references/goal.md +65 -22
  17. package/dist/commands/skill/skills/using-daynight/references/handbook.md +56 -39
  18. package/dist/commands/skill/skills/using-daynight/references/run-task.md +41 -34
  19. package/dist/commands/skill/targets.d.ts +1 -0
  20. package/dist/commands/skill/targets.js +17 -9
  21. package/dist/commands/skill/targets.js.map +1 -1
  22. package/dist/commands/task/command.js +18 -13
  23. package/dist/commands/task/command.js.map +1 -1
  24. package/dist/commands/task/definition.js +20 -21
  25. package/dist/commands/task/definition.js.map +1 -1
  26. package/dist/commands/task/rendering.js +3 -1
  27. package/dist/commands/task/rendering.js.map +1 -1
  28. package/dist/commands/update/definition.js +2 -2
  29. package/dist/commands/update/definition.js.map +1 -1
  30. package/dist/commands/update/updater.d.ts +2 -1
  31. package/dist/commands/update/updater.js +19 -4
  32. package/dist/commands/update/updater.js.map +1 -1
  33. package/dist/repository/git.d.ts +6 -3
  34. package/dist/repository/git.js +6 -4
  35. package/dist/repository/git.js.map +1 -1
  36. package/package.json +2 -2
@@ -0,0 +1,17 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { fileURLToPath } from "node:url";
3
+ import { withCliCancellation } from "../../cli/cancellation.js";
4
+ import { createCliContext } from "../../cli/context.js";
5
+ import { formatError } from "../../platform/diagnostics.js";
6
+ import { refreshInstalledSkills } from "./refresh.js";
7
+ try {
8
+ const packageDirectory = fileURLToPath(new URL("../../../", import.meta.url));
9
+ const manifest = JSON.parse(await readFile(new URL("../../../package.json", import.meta.url), "utf8"));
10
+ const context = createCliContext(manifest.version, packageDirectory);
11
+ await withCliCancellation(context, (signal) => refreshInstalledSkills(context, signal, { processGroup: "inherit" }));
12
+ }
13
+ catch (cause) {
14
+ process.stderr.write(`${formatError(cause)}\n`);
15
+ process.exitCode = 1;
16
+ }
17
+ //# sourceMappingURL=refresh-installed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-installed.js","sourceRoot":"","sources":["../../../src/commands/skill/refresh-installed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,IAAI,CAAC;IACH,MAAM,gBAAgB,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,GAAG,CAAC,uBAAuB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAwB,CAAC;IAC9H,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACrE,MAAM,mBAAmB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CliContext } from "../../cli/context.js";
2
+ import type { RepositoryGitOptions } from "../../repository/git.js";
3
+ export declare const findSkillProjectRoot: (cwd: string, signal: AbortSignal, gitOptions?: Pick<RepositoryGitOptions, "processGroup">) => Promise<string | undefined>;
4
+ export declare const refreshInstalledSkills: (context: CliContext, signal: AbortSignal, gitOptions?: Pick<RepositoryGitOptions, "processGroup">) => Promise<void>;
@@ -0,0 +1,87 @@
1
+ import { lstat } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { createOperation } from "../../api/operation.js";
4
+ import { discoverWorktreeRoot } from "../../repository/git.js";
5
+ import { skillAgents } from "./agents.js";
6
+ import { captureInstalledSkill, installSkillTargets, SkillInstallationError } from "./install.js";
7
+ import { mergeSkillTargets, planSkillTargets } from "./targets.js";
8
+ const isMissing = (cause) => cause instanceof Error && "code" in cause && cause.code === "ENOENT";
9
+ export const findSkillProjectRoot = async (cwd, signal, gitOptions = {}) => {
10
+ let directory = path.resolve(cwd);
11
+ while (true) {
12
+ signal.throwIfAborted();
13
+ let marker = false;
14
+ try {
15
+ await lstat(path.join(directory, ".git"));
16
+ marker = true;
17
+ }
18
+ catch (cause) {
19
+ if (!isMissing(cause))
20
+ throw cause;
21
+ }
22
+ if (marker) {
23
+ const operation = createOperation({ signal, limits: { totalMs: 30_000 } });
24
+ try {
25
+ return await discoverWorktreeRoot(cwd, operation, gitOptions);
26
+ }
27
+ finally {
28
+ operation.dispose();
29
+ }
30
+ }
31
+ const parent = path.dirname(directory);
32
+ if (parent === directory)
33
+ return undefined;
34
+ directory = parent;
35
+ }
36
+ };
37
+ const scopeName = (scope) => scope === "user" ? "User" : "Project";
38
+ const comparisonPath = (value) => process.platform === "win32" ? value.toLowerCase() : value;
39
+ export const refreshInstalledSkills = async (context, signal, gitOptions = {}) => {
40
+ signal.throwIfAborted();
41
+ const bases = [{ base: context.homeDirectory(), scope: "user" }];
42
+ const projectRoot = await findSkillProjectRoot(context.workingDirectory(), signal, gitOptions);
43
+ if (projectRoot !== undefined)
44
+ bases.push({ base: projectRoot, scope: "project" });
45
+ const existing = [];
46
+ for (const { base, scope } of bases) {
47
+ for (const agent of skillAgents) {
48
+ const target = (await planSkillTargets(base, [agent]))[0];
49
+ signal.throwIfAborted();
50
+ let entry;
51
+ try {
52
+ entry = await lstat(target.path);
53
+ }
54
+ catch (cause) {
55
+ if (isMissing(cause))
56
+ continue;
57
+ throw cause;
58
+ }
59
+ if (!entry.isDirectory() && !entry.isSymbolicLink())
60
+ throw new Error(`Cannot refresh using-daynight skill at ${target.path}: the installed target must be a directory or symbolic link.`);
61
+ existing.push({ target, scope });
62
+ }
63
+ }
64
+ const targets = mergeSkillTargets(existing.map(({ target }) => target));
65
+ if (targets.length === 0)
66
+ return;
67
+ const bundle = await captureInstalledSkill(context.packageDirectory);
68
+ const report = (target, status, output, detail = "") => {
69
+ for (const entry of existing.filter((entry) => comparisonPath(entry.target.path) === comparisonPath(target.path))) {
70
+ for (const agent of entry.target.agents)
71
+ output(`${status} ${agent.name}: ${scopeName(entry.scope)} using-daynight skill at ${target.path} (package ${context.version}).${detail}\n${status === "Updated" ? `${agent.reload}\n` : ""}`);
72
+ }
73
+ };
74
+ try {
75
+ await installSkillTargets(targets, bundle, signal, (target) => report(target, "Updated", context.stdout));
76
+ }
77
+ catch (cause) {
78
+ if (cause instanceof SkillInstallationError) {
79
+ if (cause.failed !== undefined)
80
+ report(cause.failed, cause.installedAtFailedTarget ? "Updated" : "Failed", context.stderr, cause.installedAtFailedTarget ? ` Legacy daynight cleanup failed at ${cause.failed.legacyPath}.` : "");
81
+ for (const target of cause.unattempted)
82
+ report(target, "Not attempted", context.stderr);
83
+ }
84
+ throw cause;
85
+ }
86
+ };
87
+ //# sourceMappingURL=refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../src/commands/skill/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGnE,MAAM,SAAS,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEpH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,GAAW,EAAE,MAAmB,EAAE,UAAU,GAA+C,EAAE,EAA+B,EAAE;IACvK,IAAI,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC;YAAC,MAAM,KAAK,CAAC,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,CAAC,CAAC,CAAC,sCAAsC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACzG,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,WAAW;gBAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
@@ -6,7 +6,7 @@ description: Manage concrete work (features, bug fixes, architecture, and their
6
6
  # Using Daynight
7
7
 
8
8
  Use the installed `daynight` CLI to keep persistent tasks aligned with the
9
- user's authorized work. Task content, approval and readiness describe work; they grant no
9
+ user's authorized work. Task content, status and readiness describe work; they grant no
10
10
  permission to implement, publish, deploy, communicate externally, merge, or push
11
11
  a mainline branch.
12
12
 
@@ -67,14 +67,13 @@ and completing `run-task` never activate it.
67
67
  Permission to create a Goal covers its discussion stages and confirmed
68
68
  in-scope breakdown, created only at the user-confirmation gates in the Goal
69
69
  protocol; unrelated work needs separate permission.
70
- - Creation produces `proposed` for every normal task and Goal stage. Approve only
71
- with explicit user authorization for that task or stated scope. A request to
72
- start a Goal discussion authorizes approval and claim of that discussion only;
73
- a user-confirmed transition authorizes the next discussion under the Goal
74
- protocol. Registration alone, complete plans, stage completion, implementation
75
- permission, `run-task` and autopilot never imply delivery approval. Explicit
76
- approval may cover the stated Goal tasks; use each reviewed task's exact version. The user can approve through CLI
77
- or Web. Approval grants no execution or delivery permission.
70
+ - Creation produces `todo` for every normal task and Goal stage and does not
71
+ start execution. A request to start a Goal discussion authorizes entering
72
+ `in_progress` for that discussion only; a user-confirmed transition authorizes
73
+ the next discussion under the Goal protocol. Registration and discussion
74
+ confirmation grant no delivery execution permission. Existing explicit
75
+ authorization may cover a stated task or fixed Goal queue and its ready
76
+ successors without another per-task authorization.
78
77
  - Use a normal task for one independently tracked outcome. Work requiring
79
78
  multiple independently tracked delivery stages is a Goal, expressed through
80
79
  existing tasks and `dependsOn`. Read [the Goal protocol](references/goal.md)
@@ -90,17 +89,25 @@ and completing `run-task` never activate it.
90
89
  acceptance criteria, and evidence. Confirm resources before linking them;
91
90
  description-relative links start at this task's attachment root. Attach resources
92
91
  according to actual ownership and need; reference shared inputs at their verified
93
- source. Express all prerequisites through `dependsOn` and their explicit external
94
- subset through `externalDependsOn`. Ordinary edges connect confirmed work in
95
- the same chain; mark a verified prerequisite from another chain as external.
92
+ source. Each Goal delivery task's description directly identifies the architecture
93
+ task and required architecture documents, including indirect successors; follow
94
+ the Goal protocol's reference and readback rules. Express all prerequisites through
95
+ `dependsOn` and their explicit external subset through `externalDependsOn`.
96
+ Ordinary edges connect confirmed work in the same chain; mark a verified
97
+ prerequisite from another chain as external.
96
98
  Both kinds block execution. CLI dependency options replace the full relationship
97
99
  set; preserve needed ordinary and external edges as the handbook requires.
98
- - Automatic task selection requires `allowAgents=true` as well as readiness.
100
+ - Automatic task selection requires `allowAgents=true`, readiness, and
101
+ `requiredPlatform` compatibility with the actual current execution environment.
102
+ Follow autopilot's runtime mapping, filter both ready and supplemental inventory
103
+ before pagination, and carry automatic selection and its platform into run-task
104
+ for a full-task recheck before version-bound `set-status in_progress`.
99
105
  Automated workers and agent workflows must not enable this permission themselves.
100
- An explicitly user-selected task may follow the manual claim path regardless
101
- of the flag; approval, dependency and execution authorization still apply.
106
+ Only an explicitly user-selected task or fixed Goal queue may follow the manual
107
+ execution path regardless of the flag or platform compatibility; dependency,
108
+ stage inputs and execution authorization still apply.
102
109
  - Preserve the exact version observed when deciding a metadata update or
103
- approve/unapprove/claim/complete action. Generic updates cannot change status. Confirm writes,
110
+ `task set-status` change. Generic updates cannot change status. Confirm writes,
104
111
  reconcile uncertain results before further mutations, and preserve actual
105
112
  failures. The handbook explains operational context; installed CLI help owns
106
113
  command usage.
@@ -26,54 +26,76 @@ possible. Do not select another task because CI, review, or merge is pending.
26
26
 
27
27
  ## Select one related task
28
28
 
29
- When there is no current task, query:
29
+ When the user explicitly supplies a task or fixed Goal queue, inspect its next
30
+ unfinished task by ID and use the manual execution path regardless of
31
+ `allowAgents` or platform compatibility. Preserve readiness, stage inputs, and
32
+ the existing execution scope; a fixed queue does not authorize unrelated discovery.
33
+ Existing scoped authorization covers its ready successors without per-task reauthorization.
34
+
35
+ Otherwise, when there is no current task, identify the actual runtime in the
36
+ environment where task commands and implementation will execute:
37
+
38
+ ```bash
39
+ node -p "process.platform"
40
+ ```
41
+
42
+ Map `win32` to `windows`, `darwin` to `macos`, and `linux` to `linux`.
43
+ A Linux runtime in WSL is `linux`, regardless of its outer Windows host.
44
+ Unsupported or unknown runtime platforms leave selection waiting with the concrete
45
+ reason. Do not substitute a configured platform, remote host OS, or requested task
46
+ platform for the observed runtime. Query platform-compatible candidates:
30
47
 
31
48
  ```bash
32
- daynight task ready --allow-agents true --json
49
+ daynight task ready --allow-agents true --compatible-platform <actual-platform> --json
33
50
  ```
34
51
 
35
- Pick exactly one approved ready `todo` task with `allowAgents=true` most relevant to the confirmed Goal and
36
- authorized work. Compare concrete actions, scope, deliverables, solution,
37
- acceptance criteria, and actual dependencies; creation order does not establish
38
- relevance. Read full details and actual task-specific and shared inputs for
39
- plausible candidates before choosing. Inspect complete `dependsOn` and the
40
- `externalDependsOn` subset. External prerequisites still block readiness, and
41
- cross-chain classification does not authorize executing them or expand the
42
- confirmed scope. Readiness checks all prerequisites, not stage artifact
43
- completeness or execution authorization. Pass the selected ID to
44
- `run-task`, which claims the version observed for that decision before starting.
45
- Autopilot never auto-approves proposed work. Goal registration, completed
46
- discussions, and permission to execute do not authorize task approval for delivery.
47
- An explicit user request to start a Goal discussion or direct its next discussion
48
- uses the Goal protocol's scoped approval and manual claim path, not automatic
49
- approval or backlog selection. Autopilot cannot supply user confirmation of
50
- requirements or solution.
51
-
52
- Ready returns at most 10 candidates by default, or the requested bounded
53
- `--limit`; it is not a complete backlog. If this page is empty or no candidate
54
- matches, obtain the additional context actually needed through selected reads,
55
- the graph, or `daynight task list --allow-agents true --json` as described in the handbook. Distinguish
56
- completed scope, work awaiting explicit approval, prerequisite-blocked work, other
57
- ongoing work, and insufficient
58
- candidates. Do not take unrelated work to stay busy or report completion from an
59
- empty or unrelated bounded page.
52
+ Pick exactly one ready `todo` task with `allowAgents=true` and `requiredPlatform`
53
+ either null or equal to the actual platform, most relevant to the confirmed Goal
54
+ and authorized work. Compare actions, scope, deliverables, solution, acceptance
55
+ criteria and actual dependencies; creation order does not establish relevance.
56
+ Read full details and actual task-specific and shared inputs for plausible
57
+ candidates. Inspect complete `dependsOn` and its `externalDependsOn` subset.
58
+ External prerequisites still block readiness, and cross-chain classification does
59
+ not authorize executing them or expand the confirmed scope. Readiness checks all
60
+ prerequisites, not stage artifact completeness or execution authorization.
61
+
62
+ Pass the selected ID, automatic-selection mode and actual platform to `run-task`.
63
+ Immediately before setting in_progress, reread the full task with
64
+ `daynight task show <task-id> --json` and recheck `todo`, ready, `allowAgents=true`,
65
+ and `requiredPlatform` either null or equal to the same actual platform. A changed
66
+ or incompatible requirement prevents starting and requires a new selection decision;
67
+ a changed execution environment requires fresh runtime identification and candidate
68
+ queries. Run-task enters in_progress using the version observed for that decision
69
+ before starting, using the exact version from this full-task recheck with
70
+ `--if-version`. An earlier compatible page does not authorize bypassing changed
71
+ eligibility. Autopilot cannot supply user confirmation of requirements or solution;
72
+ an explicit discussion-start request uses the Goal protocol's scoped manual path.
73
+
74
+ Ready returns at most 10 candidates by default or the requested bounded `--limit`;
75
+ it is not a complete backlog. Supplement an empty or unmatched page only with
76
+ needed selected reads, the graph, or
77
+ `daynight task list --allow-agents true --compatible-platform <actual-platform> --json`.
78
+ Both ready and supplemental list queries retain the actual-platform filter before
79
+ pagination and permission=true; do not filter a bounded unfiltered page locally.
80
+ Distinguish completed scope, missing execution authorization, prerequisite blockers,
81
+ other ongoing work and insufficient candidates. Do not take unrelated work to stay
82
+ busy or report completion from an empty or unrelated bounded page.
60
83
 
61
84
  Autopilot permission alone covers execution of existing tasks, not creation of
62
- new ones. An explicit user or applicable repository instruction requiring
63
- Daynight tracking or review supplies standing creation permission within the
64
- confirmed scope. If the confirmed Goal requires missing tracked work, use explicit creation
65
- permission already granted for that scope or obtain it, then use
66
- [create-task](create-task.md). Goal permission covers its discussion stages and
67
- confirmed in-scope breakdown at the Goal protocol's user-confirmation gates.
68
- Do not create architecture placeholders or delivery tasks before their gate.
69
- Delivery registration follows explicit user solution confirmation, and leaves
70
- proposed tasks pending separate explicit approval. Complete the solution
71
- discussion only after the accepted solution and actual breakdown are verified;
72
- its completion does not start delivery.
73
-
74
- Automatic selection never enables `allowAgents` on a task. If the user explicitly
75
- selects a task for execution, its manual claim path remains available regardless
76
- of the flag; preserve all approval, prerequisite and authorization checks.
85
+ new ones. Explicit user or repository tracking/review requirements supply standing
86
+ creation permission within the confirmed scope. Use existing creation permission
87
+ or obtain it before [create-task](create-task.md). Goal permission covers discussion
88
+ stages and the confirmed breakdown at user-confirmation gates; do not precreate
89
+ architecture placeholders or delivery tasks. Delivery registration leaves todo
90
+ without execution; complete solution discussion only after accepted material and
91
+ the real breakdown are verified. Existing explicit execution scope continues to
92
+ cover its ready successors without another per-task authorization.
93
+
94
+ Automatic selection never enables `allowAgents`. An explicitly selected task or
95
+ fixed Goal queue's manual execution path remains available regardless of the flag
96
+ or platform compatibility; preserve prerequisite, stage-input and authorization
97
+ checks. An automatically selected ID passed to run-task remains automatic
98
+ selection and does not acquire this manual exception.
77
99
 
78
100
  ## Advance serially and accept the scope
79
101
 
@@ -83,12 +105,11 @@ separate task. Ordinary CI, review, and merge waits keep that target. After
83
105
  task within the same authorized scope. For Goal discussions, stop at each user
84
106
  confirmation gate; completing requirements and starting solution discussion
85
107
  requires the user's explicit confirmation and direction under the Goal protocol.
86
- Solution confirmation permits proposed delivery registration, not delivery
87
- execution. Later delivery selection requires an approved ready todo with complete
88
- inputs, explicit autopilot activation, and execution authorization. Discussion
89
- completion satisfies a dependency; it never approves delivery tasks. Explicit
90
- scoped user approval may cover stated delivery tasks; Goal registration and
91
- discussion confirmation do not.
108
+ Solution confirmation permits todo delivery registration. Later delivery selection
109
+ requires a ready todo with complete inputs, explicit autopilot activation, and
110
+ execution authorization. Discussion completion satisfies a dependency and grants
111
+ no delivery execution permission. Existing scoped execution authorization
112
+ continues to apply to its stated ready successors.
92
113
 
93
114
  If `run-task` returns a wait requiring external intervention, preserve its
94
115
  current-task checkpoint and report the blocker and required next action. An
@@ -2,7 +2,7 @@
2
2
 
3
3
  Use this mode to prepare and register work that needs persistent tracking. Read
4
4
  [the handbook](handbook.md) before discovery, queries, or writes. Return after
5
- registration; registration alone does not authorize approval, execution or
5
+ registration; registration alone does not authorize execution or
6
6
  autopilot. An explicit request to start a Goal discussion routes the registered
7
7
  current stage to run-task under the Goal protocol.
8
8
 
@@ -12,8 +12,7 @@ or review supplies standing creation permission for necessary tasks within the
12
12
  confirmed scope. Reuse suitable tasks and do not ask for that permission again.
13
13
  Loading this mode, needing durable tracking, or permission to implement or run
14
14
  autopilot alone does not grant creation permission. Ask when it is missing; reuse
15
- permission already granted for the scope. Creation does not authorize approval,
16
- execution, or delivery.
15
+ permission already granted for the scope. Creation does not authorize execution or delivery.
17
16
 
18
17
  ## Choose the tracked outcome
19
18
 
@@ -37,8 +36,8 @@ or delivery tasks upfront. Its stage brief describes the discussion and its
37
36
  user-confirmation gate; finished requirements and applicable prototypes are
38
37
  outputs. User-confirmed requirements permit creation and start of solution
39
38
  discussion. Only user-confirmed solution permits actual delivery registration.
40
- A registration-only request leaves the current stage proposed and returns; an
41
- explicit discussion-start request authorizes its approval and claim through
39
+ A registration-only request leaves the current stage todo and returns; an
40
+ explicit discussion-start request authorizes its start through
42
41
  run-task. Creating a Goal covers the later in-scope stages and breakdown only
43
42
  at those confirmation gates.
44
43
 
@@ -85,6 +84,10 @@ breakdown stay with the design task. Consumers identify the source task ID and
85
84
  attachment path and confirm the contents using the installed CLI's attachment
86
85
  read command. For repository inputs, use verified immutable references. Do not
87
86
  assume a `task://` scheme, cross-task relative links, or a fixed service host.
87
+ For every Goal delivery task, list the architecture task ID and all required
88
+ architecture document references directly in its description, including indirect
89
+ successors. Use the Goal protocol's full attachment paths or immutable repository
90
+ references; keep these input references separate from execution dependencies.
88
91
  Do not upload the same whole packet to every task. Create a separate snapshot
89
92
  only when the task needs an independent copy, recording its purpose, original
90
93
  source, and source revision or content identity.
@@ -154,10 +157,14 @@ evidence. The prototype remains with its actual owner when shared across a Goal.
154
157
  ## Register and verify
155
158
 
156
159
  New tasks have `allowAgents=false`; creation cannot enable the permission.
157
- Automatic workers and agent workflows must not turn it on themselves. Approval
158
- and automatic-execution permission remain separate explicit decisions.
160
+ Automatic workers and agent workflows must not turn it on themselves. Execution
161
+ authorization and automatic-discovery permission remain separate decisions.
159
162
 
160
- Reuse the established project and suitable tasks. Create new tasks in `proposed`,
163
+ Tasks without `--required-platform` are unrestricted. Set windows, linux or macos
164
+ only when the confirmed task needs that execution environment. Platform requirements
165
+ do not start tasks or enable automatic execution; they survive all status changes.
166
+
167
+ Reuse the established project and suitable tasks. Create new tasks in `todo`,
161
168
  retaining each confirmed ID. Set concrete descriptions and actual ordinary and
162
169
  external prerequisites using the handbook's full CLI replacement rule. Upload each task's own primary Markdown and required
163
170
  resources; add actual attachment references to the complete description using
@@ -170,19 +177,19 @@ valid links and images, the two required primary-document sections, real source
170
177
  identities, complete prerequisites and their intended external subset, and applicable mock UI resources and
171
178
  interaction. For a Goal, verify only the current discussion stage and its brief;
172
179
  verify later stages and delivery tasks when their confirmation gate permits
173
- registration.
180
+ registration. When registering delivery work, check every task's description,
181
+ including indirect successors, for its architecture task ID and required document
182
+ references, and read the referenced contents under the Goal protocol.
174
183
  Registration is complete only when required artifacts and associations are
175
- confirmed readable. Without separate explicit approval authorization, leave
176
- registered work proposed and report that approval is pending. A Goal
177
- discussion-start request is scoped approval and claim authorization for that
178
- discussion, as the Goal protocol specifies; registration alone grants none.
179
- User solution confirmation permits registration of proposed delivery tasks,
180
- without granting their approval or execution. A user can explicitly approve a
181
- stated task or Goal-task scope, or approve directly through CLI/Web; an authorized Agent uses each reviewed
182
- task's exact version through `task approve`.
184
+ confirmed readable. Registration leaves work todo and does not execute it. A Goal
185
+ discussion-start request is scoped execution authorization for that discussion,
186
+ as the Goal protocol specifies. User solution confirmation permits registration
187
+ of todo delivery tasks and grants no delivery execution permission. Apply any
188
+ existing explicit execution authorization only within its stated task or Goal
189
+ scope; ready successors in an authorized fixed queue need no per-task authorization.
183
190
 
184
191
  If creation succeeds but a later operation fails, retain the confirmed IDs and
185
- resume missing operations there. Tasks remain `proposed`. Reconcile uncertain results through the handbook before another
192
+ resume missing operations there. Tasks remain `todo`. Reconcile uncertain results through the handbook before another
186
193
  mutation. Report incomplete registration with the exact missing operation or
187
194
  artifact and next step. Do not move detailed plans into descriptions to bypass
188
195
  an attachment failure. Return after verified registration without selecting or
@@ -24,11 +24,10 @@ standing creation permission within the confirmed scope. It grants no unrelated
24
24
  work, implementation, external communication, deployment, merge, or mainline push
25
25
  permission.
26
26
 
27
- A request to start a Goal discussion authorizes creating, approving, and claiming
27
+ A request to start a Goal discussion authorizes creating and starting
28
28
  that discussion task so it becomes `in_progress`. A registration-only request
29
- creates only the current discussion task in `proposed` and returns without
30
- approval or execution. A generic run request, Goal registration, or autopilot
31
- activation does not supply discussion-start or delivery approval authorization.
29
+ creates only the current discussion task in `todo` and returns without execution. A generic run request, Goal registration, or autopilot
30
+ activation does not supply discussion-start or delivery execution authorization.
32
31
 
33
32
  ## Start requirements discussion
34
33
 
@@ -40,9 +39,9 @@ questions, and observable completion conditions. Its primary Markdown's Solution
40
39
  and Acceptance criteria describe this discussion and its user-confirmation gate;
41
40
  finished requirements and prototypes are outputs, not prerequisites to starting.
42
41
 
43
- Each task starts in `proposed`. For an explicit discussion-start request, read its
44
- current materials and exact version, use `task approve`, confirm todo, then use
45
- `task claim` with the version observed for that decision and confirm `in_progress`.
42
+ Each task starts in `todo`. For an explicit discussion-start request, read its
43
+ current materials and exact version, use `task set-status <task-id> in_progress`
44
+ with the version observed for that decision and confirm `in_progress`.
46
45
  All direct prerequisites must be done. Preserve real external blockers rather
47
46
  than removing dependencies to make a discussion ready. An already in-progress
48
47
  task is resumed after checking its actual work and context.
@@ -70,15 +69,15 @@ a review result, or elapsed time does not satisfy this gate.
70
69
  Record the user's confirmation with the accepted material in the owning task and
71
70
  verify it is readable. A material revision after confirmation requires renewed
72
71
  user confirmation before advancement. When the discussion's acceptance is met,
73
- reread the task, use `task complete` with its observed version, and confirm done.
72
+ reread the task, use `task set-status <task-id> done` with its observed version, and confirm done.
74
73
  Do not create the solution discussion until that completion is confirmed; reconcile
75
74
  an uncertain completion before another mutation.
76
75
 
77
76
  Then create or reuse the solution discussion task, with a purpose-specific title
78
77
  such as `Architecture discussion: <outcome>`, and an ordinary prerequisite on the
79
78
  completed requirements task. The user's direction to start this discussion
80
- provides its scoped approval and execution authorization. Prepare its stage brief,
81
- read its current version, approve and claim through the same lifecycle, and
79
+ provides its scoped execution authorization. Prepare its stage brief,
80
+ read its current version, set in_progress through the same lifecycle, and
82
81
  confirm `in_progress`. This user-directed transition does not require autopilot
83
82
  and does not authorize selection of another unrelated task.
84
83
 
@@ -105,8 +104,8 @@ After explicit user confirmation of the current solution, record that confirmati
105
104
  with the accepted material and register the delivery breakdown below. Complete
106
105
  the solution discussion only after the accepted solution and actual registered delivery tasks,
107
106
  their required materials, and their dependencies are read back
108
- and verified. Use `task complete` with the observed version and confirm done.
109
- Completion satisfies dependencies but never approves delivery tasks. Completing
107
+ and verified. Use `task set-status <task-id> done` with the observed version and confirm done.
108
+ Completion satisfies dependencies and grants no delivery execution permission. Completing
110
109
  either discussion does not establish whole-Goal completion.
111
110
 
112
111
  ## Register the confirmed delivery breakdown
@@ -118,8 +117,8 @@ and real input references. Include independently scoped acceptance work when it
118
117
  has its own outcome; do not turn agent-generated execution steps into tasks.
119
118
  The combined scope must cover the confirmed Goal, rather than a vague placeholder.
120
119
 
121
- Create new delivery tasks in `proposed`. Solution confirmation authorizes the
122
- confirmed breakdown's registration, not approval, implementation, autopilot,
120
+ Create new delivery tasks in `todo`. Solution confirmation authorizes the
121
+ confirmed breakdown's registration, not implementation, autopilot,
123
122
  automatic-execution permission, publishing, deployment, or merge. Apply any
124
123
  separate explicit authorization only within its stated scope. New tasks have
125
124
  `allowAgents=false`; automated workflows must not enable it themselves.
@@ -135,11 +134,48 @@ replacement semantics. Do not create dependencies merely to group cards.
135
134
  Upload each task's own primary Markdown and needed resources. Keep shared
136
135
  requirements with the requirements task and the solution and breakdown with the
137
136
  solution task. Consumers reference the verified source task ID and attachment
138
- path, or an immutable repository source. Read back every task, required attachment,
139
- shared input, and dependency before reporting the breakdown registered. Keep the
140
- solution discussion `in_progress` when registration is incomplete. If the accepted
141
- solution materially changes, obtain renewed user confirmation before registering
142
- or advancing the changed work.
137
+ path, or an immutable repository source. Every delivery task's description must
138
+ directly list the architecture task ID and every architecture document required
139
+ for that task, using its full attachment path under the source task. For a
140
+ repository document, retain the architecture task ID and use a verified immutable
141
+ repository reference. Include applicable sections when they clarify what to read.
142
+ This applies to indirect successors as well as delivery roots; a reference only
143
+ in another task or the delivery task's own primary Markdown is insufficient.
144
+ These input references do not add execution dependencies or duplicate shared
145
+ documents.
146
+
147
+ Read back every task, required attachment, shared input, and dependency before
148
+ reporting the breakdown registered. Check each delivery task's description,
149
+ including indirect successors, for the architecture task ID and every required
150
+ document reference; confirm that each reference resolves to the intended readable
151
+ content. Keep the solution discussion `in_progress` when registration is incomplete.
152
+ If the accepted solution materially changes, obtain renewed user confirmation
153
+ before registering or advancing the changed work.
154
+
155
+ For an illustrative `architecture → A → B` chain, A delivers the upload API and B
156
+ delivers its retry controls. B depends on A and directly names the architecture
157
+ inputs in its description. The following task ID and paths are hypothetical;
158
+ replace them with verified sources when registering real work:
159
+
160
+ ```markdown
161
+ ## Objective and scope
162
+ Implement upload retry controls using the delivered upload API. Preserve the
163
+ selected files and show the confirmed error-specific retry actions.
164
+
165
+ ## Completion conditions
166
+ Retryable failures offer retry; permanent failures explain the required action.
167
+ Successful retry clears the error without losing the selected files.
168
+
169
+ ## Architecture inputs
170
+ Architecture task: `11111111-1111-4111-8111-111111111111`.
171
+ Read these attachments from that task before implementation:
172
+
173
+ - `design/architecture.md`: upload flow and component responsibilities.
174
+ - `design/upload-errors.md`: error classification and retry behavior.
175
+
176
+ ## Task plan
177
+ This task's `plan.md` owns its implementation plan and full acceptance criteria.
178
+ ```
143
179
 
144
180
  ## Preserve ownership and recover partial registration
145
181
 
@@ -158,7 +194,7 @@ a matching title or lost response does not establish success or failure. If the
158
194
  identity cannot be established uniquely, preserve the failure and information
159
195
  needed to reconcile it rather than creating a duplicate chain.
160
196
 
161
- Bind metadata updates, approve, unapprove, claim, and complete to the exact version
197
+ Bind metadata updates and status changes to the exact version
162
198
  observed for that decision. Attachment bytes have independent concurrency and
163
199
  must be verified separately; task versions cannot prove the reviewed content is
164
200
  unchanged. Generic updates cannot write status. A version conflict requires a
@@ -166,12 +202,19 @@ new decision. Readiness and `in_progress` provide no ownership lock or lease.
166
202
 
167
203
  ## Advance and accept the whole Goal
168
204
 
205
+ Automatic delivery discovery requires actual-runtime platform compatibility.
206
+ Use autopilot's platform-filtered queries and preserve automatic-selection context
207
+ for run-task's full-task recheck before setting in_progress. A user-specified fixed
208
+ Goal queue keeps its manual path and existing execution scope across ready successors;
209
+ it does not enable automatic discovery permission or bypass stage confirmation.
210
+
169
211
  A user-directed requirements-to-solution transition follows the confirmation
170
212
  protocol above. Ordinary `run-task` otherwise returns after its specified task
171
213
  completes or needs external intervention. Neither discussion completion nor
172
214
  breakdown registration activates autopilot or starts delivery. Only explicitly
173
- active autopilot selects later delivery work, and only with the existing approval,
174
- `allowAgents`, readiness, input, and execution requirements. CI, review, and merge
215
+ active autopilot selects later delivery work, and only with the existing readiness, input, and execution requirements. Automatic discovery
216
+ requires `allowAgents=true`; an explicitly selected task or fixed Goal queue
217
+ uses the manual execution path regardless of that flag. CI, review, and merge
175
218
  waits stay with the current delivery task.
176
219
 
177
220
  Delivery tasks follow normal run-task completion: accepted outcomes, required