taskchef 1.0.1 → 2.0.0

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.
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "taskchef",
3
+ "version": "2.0.0",
4
+ "description": "Dispatch work from a data-only workspace to visible Codex project tasks.",
5
+ "author": {
6
+ "name": "Favo Yang",
7
+ "url": "https://github.com/favoyang"
8
+ },
9
+ "homepage": "https://github.com/favoyang/taskchef#readme",
10
+ "repository": "https://github.com/favoyang/taskchef",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "codex",
14
+ "delegation",
15
+ "dispatcher",
16
+ "tasks"
17
+ ],
18
+ "skills": "./skills/",
19
+ "interface": {
20
+ "displayName": "TaskChef",
21
+ "shortDescription": "Dispatch work to the right Codex project task.",
22
+ "longDescription": "Create a data-only dispatcher workspace, route actionable requests to independently openable Codex project tasks, and reconcile saved task states on demand.",
23
+ "developerName": "Favo Yang",
24
+ "category": "Productivity",
25
+ "capabilities": [
26
+ "Read",
27
+ "Write"
28
+ ],
29
+ "websiteURL": "https://github.com/favoyang/taskchef",
30
+ "defaultPrompt": [
31
+ "$taskchef-bootstrap Set up TaskChef in this folder.",
32
+ "$taskchef-delegate Dispatch this request to the right project.",
33
+ "$taskchef-reconcile Fix outdated TaskChef task states."
34
+ ],
35
+ "brandColor": "#D97706"
36
+ }
37
+ }
package/BACKLOG.md CHANGED
@@ -17,14 +17,35 @@ This document contains capabilities intentionally excluded from the v1 MVP.
17
17
 
18
18
  ## Reconciliation and continuity
19
19
 
20
- - Add event-driven, scheduled, or background reconciliation only if interactive
21
- reconciliation proves insufficient.
20
+ - Prototype one standalone Codex Scheduled Task per dispatcher workspace. Run
21
+ it in the local project, not an isolated worktree, so updates reach the
22
+ canonical `tasks/*/task.json` records. Default to every 15 minutes and let the
23
+ user choose another cadence when enabling it.
24
+ - Use a durable prompt that explicitly invokes `$taskchef-reconcile`, names the
25
+ dispatcher workspace, processes every candidate in sequential batches of at
26
+ most eight thread snapshots, and reports only changed, blocked, finished, or
27
+ failed records. An unchanged run produces one concise no-change result.
28
+ - Add an atomic per-workspace reconciliation lease before enabling schedules.
29
+ One run acquires it, releases it on completion, and skips when another run
30
+ holds it. Treat a lease older than 30 minutes as stale and report its recovery.
31
+ - Do not retry failed snapshots within the same run. Report the affected task
32
+ IDs and let the next scheduled run retry them.
33
+ - Keep the scheduled task active when there are no candidates so later
34
+ delegations are discovered without re-enabling it. Only the user pauses or
35
+ deletes the schedule. Test the durable prompt manually before enabling it.
36
+ - Keep scheduled reconciliation opt-in. Ordinary delegation must not wait for
37
+ or invoke `$taskchef-reconcile`; users can request it explicitly to refresh
38
+ outdated states.
22
39
  - Evaluate heartbeat behavior, restart recovery, and recovery after the
23
40
  dispatcher task is deleted.
24
41
  - Add a reconciliation cursor only when repeated full snapshots become costly
25
42
  or incorrect.
26
43
  - Determine whether thread status alone is sufficient after Codex or machine
27
44
  restarts.
45
+ - Decide whether `$taskchef-bootstrap` should be renamed to
46
+ `$taskchef-workspace` or split into setup and project-management skills.
47
+ Until then, keep project listing and configuration in `$taskchef-bootstrap`
48
+ rather than mixing workspace administration into delegation.
28
49
 
29
50
  ## Grouping and history
30
51
 
@@ -63,5 +84,5 @@ This document contains capabilities intentionally excluded from the v1 MVP.
63
84
 
64
85
  - Add GitHub automation beyond storing PR and issue URLs.
65
86
  - Evaluate automatic project discovery instead of an explicit configured list.
66
- - Consider npm registry publication only after the GitHub-source installation
67
- and local managed-checkout workflows are stable.
87
+ - Evaluate marketplace discovery and update automation after the shared plugin
88
+ catalog has real usage.
package/README.md CHANGED
@@ -11,33 +11,52 @@ The canonical contract is [SPEC.md](SPEC.md). Deferred ideas are in
11
11
 
12
12
  TaskChef requires Node.js 18 or newer and Git.
13
13
 
14
- Install the CLI and its bundled skills from npm:
14
+ Add the shared Favo Yang plugin marketplace, then install TaskChef:
15
15
 
16
16
  ```sh
17
- npm install --global taskchef
17
+ codex plugin marketplace add favoyang/codex-plugins
18
+ codex plugin add taskchef@favoyang-plugins
18
19
  ```
19
20
 
20
- Then initialize a dispatcher workspace. Initialization links the three bundled
21
- TaskChef skills into that workspace; no separate skill installation is needed.
21
+ Open or create the folder that will hold TaskChef's dispatcher data, start a
22
+ new Codex task there, and ask:
23
+
24
+ ```text
25
+ $taskchef-bootstrap Set up TaskChef in this folder and help me choose projects.
26
+ ```
27
+
28
+ The plugin provides all three TaskChef skills and its deterministic CLI runtime;
29
+ dispatcher workspaces do not install or link skills themselves.
30
+
31
+ For headless CLI use, install the npm package with
32
+ `npm install --global taskchef`. Contributors can run `node bin/taskchef.js`
33
+ directly from a source checkout.
34
+
35
+ ## Updating
36
+
37
+ Refresh the marketplace and reinstall TaskChef:
22
38
 
23
39
  ```sh
24
- taskchef workspace init --workspace <workspace>
25
- taskchef doctor --workspace <workspace>
40
+ codex plugin marketplace upgrade favoyang-plugins
41
+ codex plugin add taskchef@favoyang-plugins
26
42
  ```
27
43
 
28
- Contributors working from a source checkout can run `node bin/taskchef.js`
29
- directly; this managed skills workspace installs the checkout CLI and skills
30
- with symlinks. To install an unreleased revision, use
31
- `npm install --global github:favoyang/taskchef`.
44
+ Start a new Codex task to load the updated skills.
45
+
46
+ ### Migrating from 1.x
47
+
48
+ TaskChef 2.x moves skill ownership from dispatcher-workspace symlinks to the
49
+ installed plugin. Run `$taskchef-bootstrap` once in an existing workspace to
50
+ remove the three legacy TaskChef links; unrelated `.agents` content is
51
+ preserved. The deprecated `ensureWorkspaceSkills()` export remains available
52
+ for compatibility but reports plugin-provided skills instead of creating
53
+ workspace links.
32
54
 
33
55
  ## Workspace
34
56
 
35
57
  ```text
36
58
  AGENTS.md
37
59
  taskchef.json
38
- .agents/skills/taskchef-bootstrap -> <source>/skills/taskchef-bootstrap
39
- .agents/skills/taskchef-delegate -> <source>/skills/taskchef-delegate
40
- .agents/skills/taskchef-reconcile -> <source>/skills/taskchef-reconcile
41
60
  tasks/<task-id>/task.json
42
61
  ```
43
62
 
@@ -49,7 +68,9 @@ taskchef doctor --workspace <workspace>
49
68
  ```
50
69
 
51
70
  Initialization is idempotent. It creates an empty configuration when missing
52
- and preserves existing configured projects.
71
+ and preserves existing configured projects. When upgrading from the earlier
72
+ workspace-linked distribution, initialization removes the three legacy
73
+ TaskChef skill symlinks and preserves unrelated `.agents` content.
53
74
 
54
75
  ## Projects
55
76
 
@@ -106,6 +127,9 @@ taskchef task reconcile-candidates --json --workspace <workspace>
106
127
  thread IDs. Pass `--include-finished` only for an explicit full refresh or when
107
128
  a finished executor is known to have received new work.
108
129
 
130
+ Delegation does not reconcile task states first. Ask the dispatcher to refresh
131
+ or fix outdated task states when you want it to run `$taskchef-reconcile`.
132
+
109
133
  ## Complete CLI
110
134
 
111
135
  ```text
@@ -142,15 +166,22 @@ feat!: change the workspace data contract
142
166
 
143
167
  Publishing uses npm trusted publishing from `.github/workflows/release.yml`.
144
168
  The workflow runs the test suite, validates the npm tarball, publishes the
145
- calculated version, creates the GitHub release, and commits the updated
146
- `package.json` version back to `main`.
169
+ calculated version after synchronizing the plugin manifest, creates the GitHub
170
+ release, commits the synchronized version files back to `main`, and pins the TaskChef entry
171
+ in `favoyang/codex-plugins` to that exact npm version.
172
+
173
+ The release job requires an Actions secret named `MARKETPLACE_DEPLOY_KEY`.
174
+ Store the private half of a dedicated SSH deploy key there, and add its public
175
+ half to `favoyang/codex-plugins` with write access. The key must be scoped only
176
+ to that catalog repository; the workflow's repository-scoped `GITHUB_TOKEN`
177
+ cannot update another repository.
147
178
 
148
179
  ## Development
149
180
 
150
181
  ```sh
151
182
  npm test
152
183
  npm pack --dry-run
153
- npx -y -p semantic-release@25 -p @semantic-release/git semantic-release --dry-run
184
+ npx -y -p semantic-release@25 -p @semantic-release/exec -p @semantic-release/git semantic-release --dry-run
154
185
  ```
155
186
 
156
187
  ## Boundaries
package/SPEC.md CHANGED
@@ -21,10 +21,11 @@ TaskChef is not an agent runtime, scheduler, or background service.
21
21
  6. TaskChef records the returned `threadId`, changes the status to `running`,
22
22
  and returns immediately without waiting.
23
23
  7. The user may open and prompt any delegated task directly.
24
- 8. The next user prompt in the dispatcher triggers one bounded reconciliation
25
- of active `running` and `blocked` threads.
24
+ 8. When the user asks to refresh or fix outdated task states, TaskChef performs
25
+ one bounded reconciliation of active `running` and `blocked` threads.
26
26
  9. Reconciliation updates each task's current status and result, then returns
27
- control without waiting for future activity.
27
+ control without waiting for future activity. Ordinary delegation does not
28
+ trigger reconciliation first.
28
29
 
29
30
  Multiple ongoing tasks may target the same project.
30
31
 
@@ -34,11 +35,6 @@ Multiple ongoing tasks may target the same project.
34
35
  taskchef-workspace/
35
36
  ├── AGENTS.md
36
37
  ├── taskchef.json
37
- ├── .agents/
38
- │ └── skills/
39
- │ ├── taskchef-bootstrap -> <TaskChef bootstrap skill>
40
- │ ├── taskchef-delegate -> <TaskChef delegate skill>
41
- │ └── taskchef-reconcile -> <TaskChef reconciliation skill>
42
38
  └── tasks/
43
39
  └── <task-id>/
44
40
  └── task.json
@@ -51,21 +47,24 @@ implementation utilities remain in the source repository.
51
47
  ## Dispatcher instructions
52
48
 
53
49
  TaskChef owns a marked block in the workspace `AGENTS.md`. The block tells
54
- Codex to use `taskchef-bootstrap` for workspace setup and repair, use
55
- `taskchef-reconcile` once for active work, then use
56
- `taskchef-delegate` for actionable requests without completing delegated work
57
- in the dispatcher thread.
50
+ Codex to use `$taskchef-bootstrap` for workspace setup and administration and
51
+ `$taskchef-delegate` for actionable requests without completing delegated work
52
+ in the dispatcher thread. The final instruction reserves `$taskchef-reconcile`
53
+ for user-requested refreshes or repairs of outdated task states.
58
54
 
59
55
  `workspace init` copies the canonical file when `AGENTS.md` does not exist. When it
60
56
  does exist, bootstrap preserves unrelated user content and adds or refreshes
61
57
  only the TaskChef managed block. Repeating the merge is idempotent. Malformed
62
58
  or duplicate TaskChef markers fail safely instead of overwriting the file.
63
- Initialization also installs all three TaskChef skill links. It is idempotent,
64
- takes no configuration input, creates `{ "schemaVersion": 1, "projects": [] }`
65
- when configuration is missing, and preserves existing configured projects.
59
+ The installed TaskChef plugin provides all three skills outside the dispatcher
60
+ workspace. Initialization is idempotent, takes no configuration input, creates
61
+ `{ "schemaVersion": 1, "projects": [] }` when configuration is missing, and
62
+ preserves existing configured projects. It removes only the three legacy
63
+ TaskChef skill symlinks from earlier workspaces and preserves unrelated
64
+ `.agents` content.
66
65
 
67
- `doctor` diagnoses configuration, task storage, managed instructions, skill
68
- links, project paths, and task records without modifying the workspace.
66
+ `doctor` diagnoses configuration, task storage, managed instructions, project
67
+ paths, and task records without modifying the workspace.
69
68
 
70
69
  ## Configuration
71
70
 
@@ -242,7 +241,8 @@ TaskChef does not wait for delegated tasks to finish.
242
241
 
243
242
  ## Reconciliation workflow
244
243
 
245
- The next user prompt in the dispatcher triggers reconciliation:
244
+ When the user asks to refresh or fix outdated task states, TaskChef uses
245
+ `$taskchef-reconcile` to perform one bounded pass:
246
246
 
247
247
  1. use `task reconcile-candidates --json` to load only `running` and `blocked`
248
248
  task records with executor thread IDs;
@@ -253,8 +253,8 @@ The next user prompt in the dispatcher triggers reconciliation:
253
253
 
254
254
  The native Codex thread is the live source of truth between reconciliations.
255
255
  `task.json` is only the latest reconciled snapshot. It may still say `running`
256
- after the executor has finished and before the user next prompts the
257
- dispatcher.
256
+ after the executor has finished and until the user explicitly requests a
257
+ reconciliation pass.
258
258
 
259
259
  Reconciliation must be safe to repeat. TaskChef has no reconciliation timestamp,
260
260
  event cursor, event log, callback, or automatic workspace update.
@@ -283,8 +283,9 @@ TaskChef is local, interactive, task-focused, and asynchronous. It does not incl
283
283
  - one-active-task-per-project restrictions;
284
284
  - transcript or hidden-reasoning collection;
285
285
  - arbitrary Codex task discovery;
286
- - npm registry publication; the supported distribution is a GitHub-source
287
- global install or a managed source checkout.
286
+ - bundled development-only runtimes in dispatcher workspaces. The Codex plugin
287
+ marketplace distributes the three skills, and the npm package provides the
288
+ supported headless CLI.
288
289
 
289
290
  See `BACKLOG.md` for deferred capabilities and experiments.
290
291
 
@@ -300,11 +301,11 @@ The MVP is successful when:
300
301
  4. Both `threadId` values are recorded.
301
302
  5. The dispatcher returns without waiting for execution.
302
303
  6. The user can open and prompt either delegated task directly.
303
- 7. The next dispatcher prompt reconciles each active thread once without
304
- reading finished executor threads.
304
+ 7. A user request to refresh outdated states reconciles each active thread once
305
+ without reading finished executor threads; ordinary delegation does not.
305
306
  8. Status and result snapshots are updated correctly.
306
307
  9. Two ongoing tasks may target the same project without data collisions.
307
- 10. The workspace contains dispatcher instructions, configuration, task
308
- records, and the three TaskChef skill links.
308
+ 10. The workspace contains only dispatcher instructions, configuration, and
309
+ task records; the installed plugin owns the TaskChef skills.
309
310
  11. Bootstrap creates or idempotently merges the TaskChef-managed `AGENTS.md`
310
311
  block without overwriting unrelated instructions.
@@ -3,16 +3,16 @@
3
3
 
4
4
  This repository is a TaskChef dispatcher workspace.
5
5
 
6
- - Use `taskchef-bootstrap` when initializing or refreshing this workspace,
6
+ - Use `$taskchef-bootstrap` when initializing or refreshing this workspace,
7
7
  changing or listing its configured projects, running TaskChef doctor,
8
- repairing its managed instructions, or upgrading its TaskChef skill links.
9
- - For every ordinary user prompt, use `taskchef-reconcile` first to refresh
10
- active recorded work once.
11
- - For every actionable work request, then use `taskchef-delegate`
8
+ or repairing its managed instructions.
9
+ - For every actionable work request, use `$taskchef-delegate`
12
10
  automatically, even when the user does not explicitly say "delegate" or
13
11
  mention TaskChef.
14
12
  - Do not perform delegated work directly in the dispatcher thread.
15
- - Return immediately after dispatch, as required by `taskchef-delegate`.
13
+ - Return immediately after dispatch, as required by `$taskchef-delegate`.
16
14
  - Answer directly only when the user explicitly asks about TaskChef itself or
17
15
  explicitly says not to delegate.
16
+ - Use `$taskchef-reconcile` only when the user asks to refresh or fix outdated
17
+ TaskChef task states.
18
18
  <!-- taskchef:dispatcher-instructions:end -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskchef",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "A non-blocking interactive dispatcher for visible Codex tasks.",
5
5
  "license": "MIT",
6
6
  "author": "Favo Yang",
@@ -18,6 +18,7 @@
18
18
  "taskchef": "bin/taskchef.js"
19
19
  },
20
20
  "files": [
21
+ ".codex-plugin",
21
22
  "assets",
22
23
  "BACKLOG.md",
23
24
  "bin",
@@ -31,6 +32,9 @@
31
32
  "engines": {
32
33
  "node": ">=18"
33
34
  },
35
+ "devDependencies": {
36
+ "yaml": "^2.9.0"
37
+ },
34
38
  "scripts": {
35
39
  "test": "node --test tests/taskchef.test.js"
36
40
  }
@@ -1,21 +1,21 @@
1
1
  ---
2
2
  name: taskchef-bootstrap
3
- description: "Initialize, diagnose, or refresh TaskChef dispatcher workspaces, project configuration, managed AGENTS.md instructions, and TaskChef skill links. Use when creating a TaskChef workspace, adding, importing, listing, or removing configured projects, running TaskChef doctor, repairing dispatcher setup, or upgrading installed TaskChef skills. Do not dispatch user work or reconcile executor threads."
3
+ description: "Initialize, diagnose, or refresh TaskChef dispatcher workspaces, project configuration, and managed AGENTS.md instructions. Use when creating a TaskChef workspace, adding, importing, listing, or removing configured projects, running TaskChef doctor, or repairing dispatcher setup. Do not dispatch user work or reconcile executor threads."
4
4
  ---
5
5
 
6
6
  # TaskChef Bootstrap
7
7
 
8
8
  Initialize or refresh a data-only TaskChef dispatcher workspace.
9
9
 
10
- Resolve this linked skill with `realpath`. The TaskChef source root is two
11
- parents above the skill directory. Invoke `<source-root>/bin/taskchef.js` for
10
+ Resolve this skill directory with `realpath`. The TaskChef plugin root is two
11
+ parents above the skill directory. Invoke `<plugin-root>/bin/taskchef.js` for
12
12
  all deterministic workspace operations.
13
13
 
14
14
  ## Boundaries
15
15
 
16
16
  - Keep implementation, tests, and reports in the TaskChef source repository.
17
- - Keep only `AGENTS.md`, `taskchef.json`, `tasks/*/task.json`, and the three
18
- TaskChef skill links in a dispatcher workspace.
17
+ - Keep only `AGENTS.md`, `taskchef.json`, and `tasks/*/task.json` in a
18
+ dispatcher workspace.
19
19
  - Do not dispatch tasks or reconcile executor threads during bootstrap unless
20
20
  the user separately requests those actions.
21
21
  - Never use collaboration agents, hooks, schedules, polling, or daemons.
@@ -24,7 +24,8 @@ all deterministic workspace operations.
24
24
 
25
25
  1. Run `workspace init --json`. It takes no stdin, creates an empty
26
26
  configuration when missing, and idempotently creates or refreshes the task
27
- directory, managed instructions, and all three skill links.
27
+ directory and managed instructions. The installed plugin provides all three
28
+ TaskChef skills outside the dispatcher workspace.
28
29
  2. Run `doctor --json` after setup or when the user asks to diagnose the
29
30
  workspace. Doctor is read-only; rerun `workspace init --json` to repair the
30
31
  managed scaffold.
@@ -1,22 +1,21 @@
1
1
  ---
2
2
  name: taskchef-delegate
3
- description: "Dispatch actionable requests from an initialized TaskChef workspace into independently openable Codex project tasks. Use for ordinary work requests in a TaskChef workspace, explicit delegation, splitting work across projects, or retrying pending executor creation. Dispatch must return immediately and must never use subagents, hooks, schedules, or foreground waiting. Use taskchef-bootstrap instead for workspace setup or configuration changes."
3
+ description: "Dispatch actionable requests from an initialized TaskChef workspace into independently openable Codex project tasks. Use for ordinary work requests in a TaskChef workspace, explicit delegation, splitting work across projects, or retrying pending executor creation. Dispatch must return immediately and must never use subagents, hooks, schedules, or foreground waiting."
4
4
  ---
5
5
 
6
6
  # TaskChef Delegate
7
7
 
8
8
  Create real Codex tasks from a TaskChef data workspace and return immediately.
9
- Use `taskchef-reconcile` first when the current prompt has active recorded tasks.
10
9
 
11
- Resolve this linked skill with `realpath`. The TaskChef source root is two
12
- parents above the skill directory. Invoke `<source-root>/bin/taskchef.js` for
13
- all deterministic workspace and task-record operations.
10
+ Resolve this skill directory with `realpath`. The TaskChef plugin root is two
11
+ parents above the skill directory. Use the TaskChef executable under that root
12
+ for all deterministic workspace and task-record operations.
14
13
 
15
14
  ## Boundaries
16
15
 
17
16
  - Keep implementation, tests, and reports in the TaskChef source repository.
18
- - Keep only `AGENTS.md`, `taskchef.json`, `tasks/*/task.json`, and the three
19
- TaskChef skill links in a dispatcher workspace.
17
+ - Keep only `AGENTS.md`, `taskchef.json`, and `tasks/*/task.json` in a
18
+ dispatcher workspace.
20
19
  - Use real Codex tasks, never collaboration or subagent tools.
21
20
  - Never use hooks, callbacks, schedules, polling, daemons, or event logs.
22
21
  - Never wait for delegated work after executor creation.
@@ -24,20 +23,28 @@ all deterministic workspace and task-record operations.
24
23
 
25
24
  ## Dispatch
26
25
 
27
- 1. Run `project list --json` to load and validate the configured routing
28
- targets. Use `taskchef-bootstrap` if the workspace is missing or unhealthy.
26
+ 1. Run
27
+ `<plugin-root>/bin/taskchef.js project list --json --workspace <workspace>`
28
+ to load and validate the configured routing targets. Use
29
+ `$taskchef-bootstrap` if the workspace is missing or unhealthy.
29
30
  2. Split the request into the smallest independently useful outcomes. Include
30
31
  constraints, expected testing, and reporting in every instruction.
31
32
  3. Classify against configured `name`, `githubRepo`, and `description`. Use
32
33
  `path` only as checkout identity. Ask when metadata does not produce one
33
34
  clear project match.
34
35
  4. Resolve native projects once and require the exact configured path.
35
- 5. Reuse a matching pending record for an explicit retry; otherwise create one
36
- pending record before executor creation.
36
+ 5. For an explicit retry, require the exact task ID and run
37
+ `<plugin-root>/bin/taskchef.js task show <task-id> --json --workspace <workspace>`.
38
+ Reuse the record only when its status is `pending`; ask for the task ID when
39
+ it is missing and reject retries of non-pending records. For new work, run
40
+ `<plugin-root>/bin/taskchef.js task create --json --workspace <workspace>`
41
+ with the task record JSON on stdin before executor creation.
37
42
  6. Create one real Codex task per record using the exact saved project and a
38
43
  local environment on its executor host.
39
- 7. Immediately record every returned `threadId` with status `running`. Never
40
- persist `hostId`.
44
+ 7. Immediately run
45
+ `<plugin-root>/bin/taskchef.js task update <task-id> --json --workspace <workspace>`
46
+ with the `running` status and returned `threadId` on stdin. Never persist
47
+ `hostId`.
41
48
  8. Leave a failed creation pending. Do not invent an ID or delete the record.
42
49
  9. Return immediately with a created-thread directive for every success. Do
43
50
  not read or wait for a newly created executor.
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: taskchef-reconcile
3
- description: "Reconcile active TaskChef task records with their visible Codex executor threads. Use at the start of ordinary prompts in a TaskChef workspace, for TaskChef status or progress requests, after delegated work may have completed or blocked, or for an explicitly requested full refresh. Performs one bounded snapshot pass and never polls or waits for future activity."
3
+ description: "Reconcile active TaskChef task records with their visible Codex executor threads. Use only when the user asks to refresh, fix, or repair outdated TaskChef task states. Performs one bounded snapshot pass and never polls or waits for future activity."
4
4
  ---
5
5
 
6
6
  # TaskChef Reconcile
7
7
 
8
8
  Refresh TaskChef's recorded task state from native Codex threads exactly once.
9
9
 
10
- Resolve this linked skill with `realpath`. The TaskChef source root is two
11
- parents above the skill directory. Invoke `<source-root>/bin/taskchef.js` for
10
+ Resolve this skill directory with `realpath`. The TaskChef plugin root is two
11
+ parents above the skill directory. Invoke `<plugin-root>/bin/taskchef.js` for
12
12
  all deterministic record operations.
13
13
 
14
14
  ## Reconcile
package/src/cli.js CHANGED
@@ -107,7 +107,7 @@ async function initialize(args) {
107
107
  `Workspace: ${value.workspace}`,
108
108
  `Configuration: ${value.config.action}`,
109
109
  `Instructions: ${value.instructions.action}`,
110
- `Skills: ${value.skills.skills.map((skill) => `${skill.name}=${skill.action}`).join(", ")}`,
110
+ `Legacy skill links removed: ${value.legacySkills.removed.length}`,
111
111
  ].join("\n"));
112
112
  return 0;
113
113
  }
package/src/workspace.js CHANGED
@@ -4,13 +4,12 @@ import {
4
4
  lstat,
5
5
  mkdir,
6
6
  readFile,
7
- readlink,
8
7
  readdir,
9
8
  realpath,
10
9
  link,
11
10
  rename,
11
+ rmdir,
12
12
  stat,
13
- symlink,
14
13
  unlink,
15
14
  writeFile,
16
15
  } from "node:fs/promises";
@@ -20,7 +19,10 @@ import path from "node:path";
20
19
  import { promisify } from "node:util";
21
20
 
22
21
  const execFile = promisify(execFileCallback);
23
- const DISPATCHER_INSTRUCTIONS_URL = new URL("../assets/AGENTS.md.template", import.meta.url);
22
+ const DISPATCHER_INSTRUCTIONS_URL = new URL(
23
+ "../assets/taskchef-dispatcher-instructions.md",
24
+ import.meta.url,
25
+ );
24
26
  const DISPATCHER_INSTRUCTIONS_START = "<!-- taskchef:dispatcher-instructions:start -->";
25
27
  const DISPATCHER_INSTRUCTIONS_END = "<!-- taskchef:dispatcher-instructions:end -->";
26
28
  const TASKCHEF_SKILL_NAMES = [
@@ -241,38 +243,73 @@ export async function ensureWorkspaceInstructions(workspaceRoot) {
241
243
  return { path: filePath, action };
242
244
  }
243
245
 
244
- async function ensureSkillLink(skillsDirectory, skillName) {
245
- const source = path.join(SKILLS_SOURCE_ROOT, skillName);
246
- const destination = path.join(skillsDirectory, skillName);
247
- await canonicalDirectory(source);
248
- const details = await lstat(destination).catch((error) => {
246
+ async function findLegacySkillLinks(workspaceRoot) {
247
+ const agentsDirectory = path.join(workspaceRoot, ".agents");
248
+ const agentsDetails = await lstat(agentsDirectory).catch((error) => {
249
249
  if (error.code === "ENOENT") return null;
250
250
  throw error;
251
251
  });
252
- if (details === null) {
253
- await symlink(source, destination, "dir");
254
- return { name: skillName, path: destination, action: "created" };
252
+ if (agentsDetails === null) return { agentsDirectory: null, skillsDirectory: null, links: [] };
253
+ if (agentsDetails.isSymbolicLink() || !agentsDetails.isDirectory()) {
254
+ return { agentsDirectory: null, skillsDirectory: null, links: [] };
255
255
  }
256
- if (!details.isSymbolicLink()) {
257
- throw new Error(`TaskChef skill path exists and is not a symlink: ${destination}`);
256
+
257
+ const skillsDirectory = path.join(agentsDirectory, "skills");
258
+ const skillsDetails = await lstat(skillsDirectory).catch((error) => {
259
+ if (error.code === "ENOENT") return null;
260
+ throw error;
261
+ });
262
+ if (skillsDetails === null) return { agentsDirectory, skillsDirectory, links: [] };
263
+ if (skillsDetails.isSymbolicLink() || !skillsDetails.isDirectory()) {
264
+ return { agentsDirectory, skillsDirectory: null, links: [] };
265
+ }
266
+
267
+ const links = [];
268
+ for (const skillName of TASKCHEF_SKILL_NAMES) {
269
+ const skillPath = path.join(skillsDirectory, skillName);
270
+ const details = await lstat(skillPath).catch((error) => {
271
+ if (error.code === "ENOENT") return null;
272
+ throw error;
273
+ });
274
+ if (details === null) continue;
275
+ if (!details.isSymbolicLink()) {
276
+ throw new Error(`legacy TaskChef skill path is not a symlink: ${skillPath}`);
277
+ }
278
+ links.push({ name: skillName, path: skillPath });
279
+ }
280
+ return { agentsDirectory, skillsDirectory, links };
281
+ }
282
+
283
+ async function removeLegacySkillLinks(workspaceRoot) {
284
+ const legacy = await findLegacySkillLinks(workspaceRoot);
285
+ for (const link of legacy.links) await unlink(link.path);
286
+ const removedDirectories = [];
287
+ if (legacy.skillsDirectory && (await readdir(legacy.skillsDirectory)).length === 0) {
288
+ await rmdir(legacy.skillsDirectory);
289
+ removedDirectories.push(legacy.skillsDirectory);
258
290
  }
259
- const linked = path.resolve(path.dirname(destination), await readlink(destination));
260
- if (linked !== source) {
261
- await unlink(destination);
262
- await symlink(source, destination, "dir");
263
- return { name: skillName, path: destination, action: "updated" };
291
+ if (legacy.agentsDirectory && (await readdir(legacy.agentsDirectory).catch((error) => {
292
+ if (error.code === "ENOENT") return null;
293
+ throw error;
294
+ }))?.length === 0) {
295
+ await rmdir(legacy.agentsDirectory);
296
+ removedDirectories.push(legacy.agentsDirectory);
264
297
  }
265
- return { name: skillName, path: destination, action: "unchanged" };
298
+ return { removed: legacy.links, removedDirectories };
266
299
  }
267
300
 
268
301
  export async function ensureWorkspaceSkills(workspaceRoot) {
269
302
  const root = await realpath(path.resolve(workspaceRoot));
270
- const skillsDirectory = await ensureManagedDirectory(root, ".agents", "skills");
271
- const skills = [];
272
- for (const skillName of TASKCHEF_SKILL_NAMES) {
273
- skills.push(await ensureSkillLink(skillsDirectory, skillName));
274
- }
275
- return { directory: skillsDirectory, skills };
303
+ const legacySkills = await removeLegacySkillLinks(root);
304
+ return {
305
+ directory: null,
306
+ skills: TASKCHEF_SKILL_NAMES.map((name) => ({
307
+ name,
308
+ path: path.join(SKILLS_SOURCE_ROOT, name),
309
+ action: "provided-by-plugin",
310
+ })),
311
+ legacySkills,
312
+ };
276
313
  }
277
314
 
278
315
  export async function canonicalGitRoot(projectPath) {
@@ -482,6 +519,7 @@ export async function initializeWorkspace(workspaceRoot) {
482
519
  const requestedRoot = path.resolve(workspaceRoot);
483
520
  await mkdir(requestedRoot, { recursive: true });
484
521
  const root = await realpath(requestedRoot);
522
+ const { legacySkills } = await ensureWorkspaceSkills(root);
485
523
  await ensureManagedDirectory(root, "tasks");
486
524
  const configPath = path.join(root, "taskchef.json");
487
525
  const configExists = await managedRegularFileExists(configPath);
@@ -493,16 +531,12 @@ export async function initializeWorkspace(workspaceRoot) {
493
531
  if (!configExists) await unlink(configPath).catch(() => {});
494
532
  throw error;
495
533
  });
496
- const skills = await ensureWorkspaceSkills(root).catch(async (error) => {
497
- if (!configExists) await unlink(configPath).catch(() => {});
498
- throw error;
499
- });
500
534
  return {
501
535
  workspace: root,
502
536
  config: { path: configPath, action: configExists ? "unchanged" : "created", value: config },
503
537
  tasks: { path: path.join(root, "tasks"), action: "ready" },
504
538
  instructions,
505
- skills,
539
+ legacySkills,
506
540
  };
507
541
  }
508
542
 
@@ -831,18 +865,13 @@ export async function doctorWorkspace(workspaceRoot) {
831
865
  }
832
866
  return "managed AGENTS.md instructions current";
833
867
  });
834
- for (const skillName of TASKCHEF_SKILL_NAMES) {
835
- await check(`skill:${skillName}`, async () => {
836
- const destination = path.join(root, ".agents", "skills", skillName);
837
- const details = await lstat(destination);
838
- if (!details.isSymbolicLink()) throw new Error("skill path is not a symlink");
839
- const linked = path.resolve(path.dirname(destination), await readlink(destination));
840
- const expected = path.join(SKILLS_SOURCE_ROOT, skillName);
841
- if (linked !== expected) throw new Error(`unexpected target: ${linked}`);
842
- await canonicalDirectory(expected);
843
- return "skill link valid";
844
- });
845
- }
868
+ await check("legacy-skill-links", async () => {
869
+ const legacy = await findLegacySkillLinks(root);
870
+ if (legacy.links.length > 0) {
871
+ throw new Error("legacy TaskChef skill links remain; run workspace init to remove them");
872
+ }
873
+ return "no legacy TaskChef skill links";
874
+ });
846
875
  await check("task-records", async () => {
847
876
  const taskRoot = path.join(root, "tasks");
848
877
  const entries = await readdir(taskRoot, { withFileTypes: true });