@moreih29/nexus-core 0.12.0 → 0.14.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.
Files changed (245) hide show
  1. package/README.md +76 -57
  2. package/assets/agents/architect/body.ko.md +177 -0
  3. package/{agents → assets/agents}/architect/body.md +16 -0
  4. package/assets/agents/designer/body.ko.md +125 -0
  5. package/{agents → assets/agents}/designer/body.md +16 -0
  6. package/assets/agents/engineer/body.ko.md +106 -0
  7. package/{agents → assets/agents}/engineer/body.md +14 -0
  8. package/assets/agents/lead/body.ko.md +70 -0
  9. package/assets/agents/lead/body.md +70 -0
  10. package/assets/agents/postdoc/body.ko.md +122 -0
  11. package/{agents → assets/agents}/postdoc/body.md +16 -0
  12. package/assets/agents/researcher/body.ko.md +137 -0
  13. package/{agents → assets/agents}/researcher/body.md +15 -0
  14. package/assets/agents/reviewer/body.ko.md +138 -0
  15. package/{agents → assets/agents}/reviewer/body.md +15 -0
  16. package/assets/agents/strategist/body.ko.md +116 -0
  17. package/{agents → assets/agents}/strategist/body.md +16 -0
  18. package/assets/agents/tester/body.ko.md +195 -0
  19. package/{agents → assets/agents}/tester/body.md +15 -0
  20. package/assets/agents/writer/body.ko.md +122 -0
  21. package/{agents → assets/agents}/writer/body.md +14 -0
  22. package/assets/capability-matrix.yml +198 -0
  23. package/assets/hooks/agent-bootstrap/handler.test.ts +368 -0
  24. package/assets/hooks/agent-bootstrap/handler.ts +119 -0
  25. package/assets/hooks/agent-bootstrap/meta.yml +10 -0
  26. package/assets/hooks/agent-finalize/handler.test.ts +368 -0
  27. package/assets/hooks/agent-finalize/handler.ts +76 -0
  28. package/assets/hooks/agent-finalize/meta.yml +10 -0
  29. package/assets/hooks/capability-matrix.yml +313 -0
  30. package/assets/hooks/post-tool-telemetry/handler.test.ts +302 -0
  31. package/assets/hooks/post-tool-telemetry/handler.ts +49 -0
  32. package/assets/hooks/post-tool-telemetry/meta.yml +11 -0
  33. package/assets/hooks/prompt-router/handler.test.ts +801 -0
  34. package/assets/hooks/prompt-router/handler.ts +261 -0
  35. package/assets/hooks/prompt-router/meta.yml +11 -0
  36. package/assets/hooks/session-init/handler.test.ts +274 -0
  37. package/assets/hooks/session-init/handler.ts +30 -0
  38. package/assets/hooks/session-init/meta.yml +9 -0
  39. package/assets/lsp-servers.json +55 -0
  40. package/assets/schema/lsp-servers.schema.json +67 -0
  41. package/assets/skills/nx-init/body.ko.md +197 -0
  42. package/{skills → assets/skills}/nx-init/body.md +11 -0
  43. package/assets/skills/nx-plan/body.ko.md +361 -0
  44. package/{skills → assets/skills}/nx-plan/body.md +13 -0
  45. package/assets/skills/nx-run/body.ko.md +161 -0
  46. package/{skills → assets/skills}/nx-run/body.md +11 -0
  47. package/assets/skills/nx-sync/body.ko.md +92 -0
  48. package/{skills → assets/skills}/nx-sync/body.md +10 -0
  49. package/assets/tools/tool-name-map.yml +353 -0
  50. package/dist/assets/hooks/agent-bootstrap/handler.d.ts +4 -0
  51. package/dist/assets/hooks/agent-bootstrap/handler.d.ts.map +1 -0
  52. package/dist/assets/hooks/agent-bootstrap/handler.js +100 -0
  53. package/dist/assets/hooks/agent-bootstrap/handler.js.map +1 -0
  54. package/dist/assets/hooks/agent-finalize/handler.d.ts +4 -0
  55. package/dist/assets/hooks/agent-finalize/handler.d.ts.map +1 -0
  56. package/dist/assets/hooks/agent-finalize/handler.js +63 -0
  57. package/dist/assets/hooks/agent-finalize/handler.js.map +1 -0
  58. package/dist/assets/hooks/post-tool-telemetry/handler.d.ts +4 -0
  59. package/dist/assets/hooks/post-tool-telemetry/handler.d.ts.map +1 -0
  60. package/dist/assets/hooks/post-tool-telemetry/handler.js +40 -0
  61. package/dist/assets/hooks/post-tool-telemetry/handler.js.map +1 -0
  62. package/dist/assets/hooks/prompt-router/handler.d.ts +4 -0
  63. package/dist/assets/hooks/prompt-router/handler.d.ts.map +1 -0
  64. package/dist/assets/hooks/prompt-router/handler.js +204 -0
  65. package/dist/assets/hooks/prompt-router/handler.js.map +1 -0
  66. package/dist/assets/hooks/session-init/handler.d.ts +4 -0
  67. package/dist/assets/hooks/session-init/handler.d.ts.map +1 -0
  68. package/dist/assets/hooks/session-init/handler.js +23 -0
  69. package/dist/assets/hooks/session-init/handler.js.map +1 -0
  70. package/dist/hooks/agent-bootstrap.js +105 -0
  71. package/dist/hooks/agent-finalize.js +164 -0
  72. package/dist/hooks/post-tool-telemetry.js +55 -0
  73. package/dist/hooks/prompt-router.js +7300 -0
  74. package/dist/hooks/session-init.js +21 -0
  75. package/dist/manifests/claude-hooks.json +52 -0
  76. package/dist/manifests/codex-hooks.json +28 -0
  77. package/dist/manifests/opencode-manifest.json +44 -0
  78. package/dist/manifests/portability-report.json +87 -0
  79. package/dist/scripts/build-agents.d.ts +157 -0
  80. package/dist/scripts/build-agents.d.ts.map +1 -0
  81. package/dist/scripts/build-agents.js +737 -0
  82. package/dist/scripts/build-agents.js.map +1 -0
  83. package/dist/scripts/build-hooks.d.ts +16 -0
  84. package/dist/scripts/build-hooks.d.ts.map +1 -0
  85. package/dist/scripts/build-hooks.js +388 -0
  86. package/dist/scripts/build-hooks.js.map +1 -0
  87. package/dist/scripts/cli.d.ts +54 -0
  88. package/dist/scripts/cli.d.ts.map +1 -0
  89. package/dist/scripts/cli.js +467 -0
  90. package/dist/scripts/cli.js.map +1 -0
  91. package/dist/src/hooks/opencode-mount.d.ts +35 -0
  92. package/dist/src/hooks/opencode-mount.d.ts.map +1 -0
  93. package/dist/src/hooks/opencode-mount.js +352 -0
  94. package/dist/src/hooks/opencode-mount.js.map +1 -0
  95. package/dist/src/hooks/runtime.d.ts +37 -0
  96. package/dist/src/hooks/runtime.d.ts.map +1 -0
  97. package/dist/src/hooks/runtime.js +274 -0
  98. package/dist/src/hooks/runtime.js.map +1 -0
  99. package/dist/src/hooks/types.d.ts +196 -0
  100. package/dist/src/hooks/types.d.ts.map +1 -0
  101. package/dist/src/hooks/types.js +85 -0
  102. package/dist/src/hooks/types.js.map +1 -0
  103. package/dist/src/lsp/cache.d.ts +9 -0
  104. package/dist/src/lsp/cache.d.ts.map +1 -0
  105. package/dist/src/lsp/cache.js +216 -0
  106. package/dist/src/lsp/cache.js.map +1 -0
  107. package/dist/src/lsp/client.d.ts +24 -0
  108. package/dist/src/lsp/client.d.ts.map +1 -0
  109. package/dist/src/lsp/client.js +166 -0
  110. package/dist/src/lsp/client.js.map +1 -0
  111. package/dist/src/lsp/detect.d.ts +77 -0
  112. package/dist/src/lsp/detect.d.ts.map +1 -0
  113. package/dist/src/lsp/detect.js +116 -0
  114. package/dist/src/lsp/detect.js.map +1 -0
  115. package/dist/src/mcp/server.d.ts +5 -0
  116. package/dist/src/mcp/server.d.ts.map +1 -0
  117. package/dist/src/mcp/server.js +34 -0
  118. package/dist/src/mcp/server.js.map +1 -0
  119. package/dist/src/mcp/tools/artifact.d.ts +4 -0
  120. package/dist/src/mcp/tools/artifact.d.ts.map +1 -0
  121. package/dist/src/mcp/tools/artifact.js +36 -0
  122. package/dist/src/mcp/tools/artifact.js.map +1 -0
  123. package/dist/src/mcp/tools/history.d.ts +3 -0
  124. package/dist/src/mcp/tools/history.d.ts.map +1 -0
  125. package/dist/src/mcp/tools/history.js +29 -0
  126. package/dist/src/mcp/tools/history.js.map +1 -0
  127. package/dist/src/mcp/tools/lsp.d.ts +13 -0
  128. package/dist/src/mcp/tools/lsp.d.ts.map +1 -0
  129. package/dist/src/mcp/tools/lsp.js +225 -0
  130. package/dist/src/mcp/tools/lsp.js.map +1 -0
  131. package/dist/src/mcp/tools/plan.d.ts +3 -0
  132. package/dist/src/mcp/tools/plan.d.ts.map +1 -0
  133. package/dist/src/mcp/tools/plan.js +317 -0
  134. package/dist/src/mcp/tools/plan.js.map +1 -0
  135. package/dist/src/mcp/tools/task.d.ts +3 -0
  136. package/dist/src/mcp/tools/task.d.ts.map +1 -0
  137. package/dist/src/mcp/tools/task.js +252 -0
  138. package/dist/src/mcp/tools/task.js.map +1 -0
  139. package/dist/src/shared/invocations.d.ts +74 -0
  140. package/dist/src/shared/invocations.d.ts.map +1 -0
  141. package/dist/src/shared/invocations.js +247 -0
  142. package/dist/src/shared/invocations.js.map +1 -0
  143. package/dist/src/shared/json-store.d.ts +37 -0
  144. package/dist/src/shared/json-store.d.ts.map +1 -0
  145. package/dist/src/shared/json-store.js +163 -0
  146. package/dist/src/shared/json-store.js.map +1 -0
  147. package/dist/src/shared/mcp-utils.d.ts +3 -0
  148. package/dist/src/shared/mcp-utils.d.ts.map +1 -0
  149. package/dist/src/shared/mcp-utils.js +6 -0
  150. package/dist/src/shared/mcp-utils.js.map +1 -0
  151. package/dist/src/shared/paths.d.ts +21 -0
  152. package/dist/src/shared/paths.d.ts.map +1 -0
  153. package/dist/src/shared/paths.js +81 -0
  154. package/dist/src/shared/paths.js.map +1 -0
  155. package/dist/src/shared/tool-log.d.ts +8 -0
  156. package/dist/src/shared/tool-log.d.ts.map +1 -0
  157. package/dist/src/shared/tool-log.js +22 -0
  158. package/dist/src/shared/tool-log.js.map +1 -0
  159. package/dist/src/types/state.d.ts +862 -0
  160. package/dist/src/types/state.d.ts.map +1 -0
  161. package/dist/src/types/state.js +66 -0
  162. package/dist/src/types/state.js.map +1 -0
  163. package/docs/consuming/codex-lead-merge.md +106 -0
  164. package/docs/plugin-guide.md +396 -0
  165. package/docs/plugin-template/claude/.github/workflows/build.yml +60 -0
  166. package/docs/plugin-template/claude/README.md +110 -0
  167. package/docs/plugin-template/claude/package.json +16 -0
  168. package/docs/plugin-template/codex/.github/workflows/build.yml +51 -0
  169. package/docs/plugin-template/codex/README.md +147 -0
  170. package/docs/plugin-template/codex/package.json +17 -0
  171. package/docs/plugin-template/opencode/.github/workflows/build.yml +61 -0
  172. package/docs/plugin-template/opencode/README.md +121 -0
  173. package/docs/plugin-template/opencode/package.json +25 -0
  174. package/package.json +36 -28
  175. package/agents/architect/meta.yml +0 -13
  176. package/agents/designer/meta.yml +0 -13
  177. package/agents/engineer/meta.yml +0 -11
  178. package/agents/postdoc/meta.yml +0 -13
  179. package/agents/researcher/meta.yml +0 -12
  180. package/agents/reviewer/meta.yml +0 -12
  181. package/agents/strategist/meta.yml +0 -13
  182. package/agents/tester/meta.yml +0 -12
  183. package/agents/writer/meta.yml +0 -11
  184. package/conformance/README.md +0 -311
  185. package/conformance/examples/plan.extension.schema.example.json +0 -25
  186. package/conformance/lifecycle/README.md +0 -48
  187. package/conformance/lifecycle/agent-complete.json +0 -44
  188. package/conformance/lifecycle/agent-resume.json +0 -43
  189. package/conformance/lifecycle/agent-spawn.json +0 -36
  190. package/conformance/lifecycle/memory-access-record.json +0 -27
  191. package/conformance/lifecycle/session-end.json +0 -48
  192. package/conformance/scenarios/full-plan-cycle.json +0 -147
  193. package/conformance/scenarios/task-deps-ordering.json +0 -95
  194. package/conformance/schema/fixture.schema.json +0 -354
  195. package/conformance/state-schemas/agent-tracker.schema.json +0 -63
  196. package/conformance/state-schemas/history.schema.json +0 -134
  197. package/conformance/state-schemas/memory-access.schema.json +0 -36
  198. package/conformance/state-schemas/plan.schema.json +0 -77
  199. package/conformance/state-schemas/tasks.schema.json +0 -98
  200. package/conformance/tools/artifact-write.json +0 -97
  201. package/conformance/tools/context.json +0 -172
  202. package/conformance/tools/history-search.json +0 -219
  203. package/conformance/tools/plan-decide.json +0 -139
  204. package/conformance/tools/plan-start.json +0 -81
  205. package/conformance/tools/plan-status.json +0 -127
  206. package/conformance/tools/plan-update.json +0 -341
  207. package/conformance/tools/task-add.json +0 -156
  208. package/conformance/tools/task-close.json +0 -161
  209. package/conformance/tools/task-list.json +0 -177
  210. package/conformance/tools/task-update.json +0 -167
  211. package/docs/behavioral-contracts.md +0 -145
  212. package/docs/consumer-implementation-guide.md +0 -840
  213. package/docs/memory-lifecycle-contract.md +0 -119
  214. package/docs/nexus-layout.md +0 -224
  215. package/docs/nexus-outputs-contract.md +0 -344
  216. package/docs/nexus-state-overview.md +0 -170
  217. package/docs/nexus-tools-contract.md +0 -438
  218. package/manifest.json +0 -448
  219. package/schema/README.md +0 -69
  220. package/schema/agent.schema.json +0 -23
  221. package/schema/common.schema.json +0 -17
  222. package/schema/manifest.schema.json +0 -78
  223. package/schema/memory-policy.schema.json +0 -98
  224. package/schema/skill.schema.json +0 -54
  225. package/schema/task-exceptions.schema.json +0 -40
  226. package/schema/vocabulary.schema.json +0 -167
  227. package/scripts/.gitkeep +0 -0
  228. package/scripts/conformance-coverage.ts +0 -466
  229. package/scripts/import-from-claude-nexus.ts +0 -403
  230. package/scripts/lib/frontmatter.ts +0 -71
  231. package/scripts/lib/lint.ts +0 -348
  232. package/scripts/lib/structure.ts +0 -159
  233. package/scripts/lib/validate.ts +0 -796
  234. package/scripts/validate.ts +0 -90
  235. package/skills/nx-init/meta.yml +0 -8
  236. package/skills/nx-plan/meta.yml +0 -10
  237. package/skills/nx-run/meta.yml +0 -8
  238. package/skills/nx-sync/meta.yml +0 -7
  239. package/vocabulary/capabilities.yml +0 -65
  240. package/vocabulary/categories.yml +0 -11
  241. package/vocabulary/invocations.yml +0 -147
  242. package/vocabulary/memory_policy.yml +0 -88
  243. package/vocabulary/resume-tiers.yml +0 -11
  244. package/vocabulary/tags.yml +0 -60
  245. package/vocabulary/task-exceptions.yml +0 -29
@@ -1,438 +0,0 @@
1
- # Nexus MCP Tool Contracts
2
-
3
- This document is the normative specification for the eleven Nexus MCP tools. Implementations in all consumer harnesses (claude-nexus, opencode-nexus) must conform to the parameter names, types, return shapes, side effects, and error conditions defined here. Harness-specific registration names (prefixes such as `nx_` or `mcp__plugin_*`) are implementation details and are not part of this specification.
4
-
5
- ---
6
-
7
- ## plan_start
8
-
9
- Creates a new planning session. If a plan session is already active (i.e., `plan.json` exists), it is automatically archived to `history.json` before the new session is written.
10
-
11
- ### Parameters
12
-
13
- | Name | Type | Required | Description |
14
- |------|------|----------|-------------|
15
- | `topic` | `string` | yes | Theme or subject of the planning session |
16
- | `issues` | `string[]` | yes | Ordered list of agenda items to resolve during the session |
17
- | `research_summary` | `string` | yes | Evidence that prerequisite research has been completed; serves as a gate to enforce research before planning |
18
-
19
- ### Return Value
20
-
21
- | Field | Type | Description |
22
- |-------|------|-------------|
23
- | `created` | `boolean` | Always `true` on success |
24
- | `plan_id` | `number` | Monotonically increasing identifier assigned to the new plan; derived by incrementing the highest `id` found across all archived cycles in `history.json` |
25
- | `topic` | `string` | Echo of the `topic` parameter |
26
- | `issueCount` | `number` | Number of issues registered in the new session |
27
- | `previousArchived` | `boolean` | `true` if a pre-existing `plan.json` was archived before creating the new session |
28
-
29
- ### Side Effects
30
-
31
- - Creates `.nexus/state/plan.json` with `id`, `topic`, `issues` (each with `id`, `title`, `status: "pending"`), `research_summary`, and `created_at`.
32
- - If a prior `plan.json` existed, appends a cycle record to `.nexus/history.json` (creating the file if absent), then deletes the prior `plan.json`.
33
-
34
- ### Error Conditions
35
-
36
- - No explicit error return; the tool always succeeds if called with valid parameters. Callers must ensure `research_summary` is a non-empty string — the parameter is required by schema, but an empty string is not rejected at the tool level.
37
-
38
- ---
39
-
40
- ## plan_status
41
-
42
- Returns the current state of the active planning session.
43
-
44
- ### Parameters
45
-
46
- None.
47
-
48
- ### Return Value
49
-
50
- When no session is active:
51
-
52
- | Field | Type | Description |
53
- |-------|------|-------------|
54
- | `active` | `boolean` | Always `false` |
55
-
56
- When a session is active:
57
-
58
- | Field | Type | Description |
59
- |-------|------|-------------|
60
- | `active` | `boolean` | Always `true` |
61
- | `plan_id` | `number` | Identifier of the active plan |
62
- | `topic` | `string` | Planning session theme |
63
- | `issues` | `PlanIssue[]` | Full list of issues with their current state (see schema below) |
64
- | `research_summary` | `string \| undefined` | Research evidence recorded at session creation |
65
- | `summary.total` | `number` | Total number of issues |
66
- | `summary.pending` | `number` | Issues not yet decided |
67
- | `summary.decided` | `number` | Issues with a recorded decision |
68
-
69
- **PlanIssue schema:**
70
-
71
- | Field | Type | Description |
72
- |-------|------|-------------|
73
- | `id` | `number` | Issue identifier, unique within the plan |
74
- | `title` | `string` | Issue description |
75
- | `status` | `"pending" \| "decided"` | Current resolution state |
76
- | `decision` | `string \| undefined` | Decision summary, present only when `status` is `"decided"` |
77
- | `how_agents` | `string[] \| undefined` | Names of HOW agents that participated in analysis |
78
- | `how_summary` | `Record<string, string> \| undefined` | Key positions per agent |
79
- | `how_agent_ids` | `Record<string, string> \| undefined` | Agent name to agent-instance ID mapping, for session resume |
80
-
81
- ### Side Effects
82
-
83
- None. Read-only.
84
-
85
- ### Error Conditions
86
-
87
- None. Returns `{ active: false }` when `plan.json` does not exist.
88
-
89
- ---
90
-
91
- ## plan_update
92
-
93
- Mutates the issue list of the active planning session. Supports four discrete actions.
94
-
95
- ### Parameters
96
-
97
- | Name | Type | Required | Description |
98
- |------|------|----------|-------------|
99
- | `action` | `"add" \| "remove" \| "edit" \| "reopen"` | yes | Operation to perform |
100
- | `issue_id` | `number` | conditional | Target issue identifier; required for `remove`, `edit`, and `reopen` |
101
- | `title` | `string` | conditional | Issue title text; required for `add` and `edit` |
102
-
103
- ### Return Value
104
-
105
- All responses include an `issue` field containing the affected `PlanIssue` object.
106
-
107
- The `issue` object contains:
108
-
109
- | Field | Type | Presence |
110
- |-------|------|----------|
111
- | `id` | `number` | always |
112
- | `title` | `string` | on `add`, `edit`, `reopen` |
113
- | `status` | `"pending" \| "decided"` | on `add`, `reopen` |
114
-
115
- The discriminating field varies by action:
116
-
117
- | Action | Discriminating Field | Value |
118
- |--------|----------------------|-------|
119
- | `add` | `added` | `true` |
120
- | `remove` | `removed` | `true` |
121
- | `edit` | `edited` | `true` |
122
- | `reopen` | `reopened` | `true` |
123
-
124
- On error, returns `{ error: string }`.
125
-
126
- ### Side Effects
127
-
128
- - Writes the updated issue list back to `.nexus/state/plan.json`.
129
- - For `reopen`: clears `status` to `"pending"` and removes the `decision` field from the target issue.
130
-
131
- ### Error Conditions
132
-
133
- | Condition | Error message |
134
- |-----------|---------------|
135
- | No active plan session | `"No active plan session"` |
136
- | `remove` or `reopen` called without `issue_id` | `"issue_id is required for <action>"` |
137
- | `edit` called without `issue_id` or `title` | `"issue_id and title are required for edit"` |
138
- | `add` called without `title` | `"title is required for add"` |
139
- | Referenced `issue_id` not found | `"Issue <id> not found"` |
140
- | Unrecognized `action` value | `"Unknown action"` |
141
-
142
- ---
143
-
144
- ## plan_decide
145
-
146
- Records a decision for a specific issue and marks it as `"decided"`. Triggered by the `[d]` tag convention.
147
-
148
- ### Parameters
149
-
150
- | Name | Type | Required | Description |
151
- |------|------|----------|-------------|
152
- | `issue_id` | `number` | yes | Identifier of the issue being decided |
153
- | `decision` | `string` | yes | Decision text to record against the issue |
154
- | `how_agents` | `string[]` | no | Names of HOW agents that contributed analysis |
155
- | `how_summary` | `Record<string, string>` | no | Per-agent key position summaries |
156
- | `how_agent_ids` | `Record<string, string>` | no | Agent name to agent-instance ID mapping for future resume |
157
-
158
- ### Return Value
159
-
160
- | Field | Type | Description |
161
- |-------|------|-------------|
162
- | `decided` | `boolean` | Always `true` on success |
163
- | `issue` | `string` | Title of the decided issue |
164
- | `allComplete` | `boolean` | `true` if every issue in the plan now has `status: "decided"` |
165
- | `message` | `string \| undefined` | Guidance for the next step, present only when `allComplete` is `true` |
166
- | `remaining` | `Array<{id, title, status}>` \| undefined | List of undecided issues, present only when `allComplete` is `false` |
167
-
168
- ### Side Effects
169
-
170
- - Updates the target issue in `.nexus/state/plan.json`: sets `status` to `"decided"`, writes `decision`, and conditionally writes `how_agents`, `how_summary`, `how_agent_ids`.
171
-
172
- ### Error Conditions
173
-
174
- | Condition | Error message |
175
- |-----------|---------------|
176
- | No active plan session | `"No active plan session"` |
177
- | Referenced `issue_id` not found | `"Issue <id> not found"` |
178
-
179
- ---
180
-
181
- ## task_list
182
-
183
- Returns the full task list with a computed progress summary.
184
-
185
- ### Parameters
186
-
187
- None.
188
-
189
- ### Return Value
190
-
191
- When `tasks.json` does not exist:
192
-
193
- | Field | Type | Description |
194
- |-------|------|-------------|
195
- | `exists` | `boolean` | Always `false` |
196
-
197
- When `tasks.json` exists:
198
-
199
- | Field | Type | Description |
200
- |-------|------|-------------|
201
- | `goal` | `string` | Top-level goal for this task cycle |
202
- | `tasks` | `Task[]` | Full task list (see Task schema below) |
203
- | `summary.total` | `number` | Total task count |
204
- | `summary.completed` | `number` | Tasks with `status: "completed"` |
205
- | `summary.pending` | `number` | Tasks with `status: "pending"` |
206
- | `summary.blocked` | `number` | Tasks with `status: "in_progress"` |
207
- | `summary.ready` | `number[]` | IDs of pending tasks whose dependencies are all completed |
208
-
209
- **Task schema:**
210
-
211
- | Field | Type | Description |
212
- |-------|------|-------------|
213
- | `id` | `number` | Task identifier, unique within the cycle |
214
- | `title` | `string` | Task title |
215
- | `context` | `string` | Background or description |
216
- | `approach` | `string \| undefined` | Implementation approach |
217
- | `acceptance` | `string \| undefined` | Definition of done |
218
- | `risk` | `string \| undefined` | Known risks or caveats |
219
- | `status` | `"pending" \| "in_progress" \| "completed"` | Current state |
220
- | `deps` | `number[]` | IDs of tasks that must be completed before this one |
221
- | `plan_issue` | `number \| undefined` | Source issue ID in the associated plan session |
222
- | `owner` | `string \| undefined` | Assigned agent name |
223
- | `owner_agent_id` | `string \| undefined` | Agent instance ID for session resume |
224
- | `owner_reuse_policy` | `"fresh" \| "resume_if_same_artifact" \| "resume" \| undefined` | Agent spawn policy |
225
- | `created_at` | `string \| undefined` | ISO 8601 creation timestamp |
226
-
227
- ### Side Effects
228
-
229
- None. Read-only.
230
-
231
- ### Error Conditions
232
-
233
- None. Returns `{ exists: false }` when `tasks.json` does not exist.
234
-
235
- ---
236
-
237
- ## task_add
238
-
239
- Adds a new task to the active task list. Creates `tasks.json` if it does not exist.
240
-
241
- ### Parameters
242
-
243
- | Name | Type | Required | Description |
244
- |------|------|----------|-------------|
245
- | `title` | `string` | yes | Task title |
246
- | `context` | `string` | yes | Background or description of the task |
247
- | `deps` | `number[]` | no | IDs of prerequisite tasks; defaults to `[]` |
248
- | `approach` | `string` | no | Proposed implementation approach |
249
- | `acceptance` | `string` | no | Acceptance criteria defining done |
250
- | `risk` | `string` | no | Known risks or caveats |
251
- | `plan_issue` | `number` | no | Plan issue ID this task originates from |
252
- | `goal` | `string` | no | Sets or replaces the top-level goal of the task list |
253
- | `decisions` | `string[]` | no | Decision strings to append to the task list's `decisions` array |
254
- | `owner` | `string` | no | Assignee agent name |
255
- | `owner_agent_id` | `string` | no | Agent instance ID for resume; if absent, a fresh instance is spawned |
256
- | `owner_reuse_policy` | `"fresh" \| "resume_if_same_artifact" \| "resume"` | no | Controls agent reuse: `fresh` forces a new spawn; `resume_if_same_artifact` resumes only if the prior agent touched the same target file; `resume` always resumes |
257
-
258
- ### Return Value
259
-
260
- | Field | Type | Description |
261
- |-------|------|-------------|
262
- | `task` | `Task` | The newly created task object |
263
-
264
- ### Side Effects
265
-
266
- - Creates `.nexus/state/tasks.json` if absent (initializing `goal: ""`, `decisions: []`, `tasks: []`).
267
- - Appends the new task with an auto-incremented `id` (max existing `id` + 1).
268
- - If `goal` is provided, overwrites the file-level `goal` field.
269
- - If `decisions` is provided, appends to the file-level `decisions` array.
270
-
271
- ### Error Conditions
272
-
273
- None. The tool always succeeds when called with the required parameters.
274
-
275
- ---
276
-
277
- ## task_update
278
-
279
- Updates the status of an existing task.
280
-
281
- ### Parameters
282
-
283
- | Name | Type | Required | Description |
284
- |------|------|----------|-------------|
285
- | `id` | `number` | yes | Identifier of the task to update |
286
- | `status` | `"pending" \| "in_progress" \| "completed"` | yes | New status value |
287
-
288
- ### Return Value
289
-
290
- | Field | Type | Description |
291
- |-------|------|-------------|
292
- | `task` | `Task` | The updated task object |
293
-
294
- ### Side Effects
295
-
296
- - Writes the updated status back to `.nexus/state/tasks.json`.
297
-
298
- ### Error Conditions
299
-
300
- | Condition | Error message |
301
- |-----------|---------------|
302
- | `tasks.json` does not exist | `"tasks.json not found"` |
303
- | Referenced `id` not found | `"Task id <id> not found"` |
304
-
305
- ---
306
-
307
- ## task_close
308
-
309
- Closes the current work cycle by archiving the active plan and task list to `history.json`, then deleting all session-scoped state files.
310
-
311
- ### Parameters
312
-
313
- None.
314
-
315
- ### Return Value
316
-
317
- | Field | Type | Description |
318
- |-------|------|-------------|
319
- | `closed` | `boolean` | Always `true` |
320
- | `cycle` | `string` | ISO 8601 timestamp of the closed cycle |
321
- | `branch` | `string` | Git branch name at time of closure |
322
- | `archived.plan` | `boolean` | `true` if a `plan.json` was present and archived |
323
- | `archived.decisions` | `number` | Count of decided issues archived from the plan |
324
- | `archived.tasks` | `number` | Count of tasks archived |
325
- | `deleted` | `string[]` | Filenames of deleted session-state files |
326
- | `total_cycles` | `number` | Total number of cycles in `history.json` after closure |
327
- | `memoryHint.taskCount` | `number` | Number of tasks in the closed cycle |
328
- | `memoryHint.decisionCount` | `number` | Number of decided issues in the closed cycle |
329
- | `memoryHint.cycleTopics` | `string[]` | Non-empty strings from `plan.topic` and `tasks.goal` |
330
-
331
- ### Side Effects
332
-
333
- - Appends a cycle record to `.nexus/history.json` (creating the file if absent). The record contains `completed_at`, `branch`, `plan` (full `PlanFile` or `null`), and `tasks` (full `Task[]`).
334
- - Deletes the following session-scoped files if they exist: `plan.json`, `tasks.json` (all within `.nexus/state/`).
335
-
336
- Harness-local tracker files (`edit-tracker.json`, `reopen-tracker.json`, and any other files under `.nexus/state/{harness-id}/`) are not managed by `task_close`. Their lifecycle is the responsibility of consumer harness session hooks.
337
-
338
- ### Error Conditions
339
-
340
- None. The tool succeeds even when no plan or tasks are active; it archives whatever state exists.
341
-
342
- ---
343
-
344
- ## history_search
345
-
346
- Searches past plan/task cycles recorded in `history.json`.
347
-
348
- ### Parameters
349
-
350
- | Name | Type | Required | Description |
351
- |------|------|----------|-------------|
352
- | `query` | `string` | no | Search term matched case-insensitively against the full JSON of each cycle (topic, decisions, research_summary, task titles, etc.) |
353
- | `last_n` | `number` | no | Return only the last N matching cycles; defaults to `10` |
354
-
355
- ### Return Value
356
-
357
- | Field | Type | Description |
358
- |-------|------|-------------|
359
- | `total` | `number` | Total number of matching cycles before limiting |
360
- | `showing` | `number` | Number of cycles returned |
361
- | `cycles` | `CycleSummary[]` | Summarized cycle records (see below) |
362
-
363
- **CycleSummary schema:**
364
-
365
- | Field | Type | Description |
366
- |-------|------|-------------|
367
- | `completed_at` | `string` | ISO 8601 timestamp of cycle closure |
368
- | `branch` | `string` | Git branch at time of closure |
369
- | `topic` | `string \| undefined` | Plan topic, if a plan was archived |
370
- | `decisions` | `Array<{title, decision}>` \| undefined | Decided issues from the plan |
371
- | `task_count` | `number \| undefined` | Number of tasks in the cycle |
372
-
373
- ### Side Effects
374
-
375
- None. Read-only.
376
-
377
- ### Error Conditions
378
-
379
- None. Returns `{ cycles: [], total: 0 }` when `history.json` does not exist.
380
-
381
- ---
382
-
383
- ## context
384
-
385
- Returns a snapshot of the current session context: active task summary, decisions, and current branch.
386
-
387
- ### Parameters
388
-
389
- None.
390
-
391
- ### Return Value
392
-
393
- | Field | Type | Description |
394
- |-------|------|-------------|
395
- | `branch` | `string` | Current git branch |
396
- | `activeMode` | `"team" \| null` | `"team"` if `tasks.json` is present; `null` otherwise |
397
- | `goal` | `string \| undefined` | Top-level goal from `tasks.json`; present only when `activeMode` is `"team"` |
398
- | `tasksSummary.total` | `number \| undefined` | Total task count; present only when `activeMode` is `"team"` |
399
- | `tasksSummary.completed` | `number \| undefined` | Completed task count; present only when `activeMode` is `"team"` |
400
- | `tasksSummary.pending` | `number \| undefined` | Pending task count; present only when `activeMode` is `"team"` |
401
- | `decisions` | `string[]` | Decisions from `decisions.json`; empty array if the file does not exist |
402
-
403
- ### Side Effects
404
-
405
- None. Read-only.
406
-
407
- ### Error Conditions
408
-
409
- None. Partial data (e.g., malformed JSON in `tasks.json` or `decisions.json`) is silently ignored; the tool returns whatever it can read.
410
-
411
- ---
412
-
413
- ## artifact_write
414
-
415
- Writes a named artifact file (report, synthesis, analysis output) to the session artifact directory.
416
-
417
- ### Parameters
418
-
419
- | Name | Type | Required | Description |
420
- |------|------|----------|-------------|
421
- | `filename` | `string` | yes | Name of the file to write (e.g., `"findings.md"`, `"synthesis.md"`) |
422
- | `content` | `string` | yes | Full content to write to the file |
423
-
424
- ### Return Value
425
-
426
- | Field | Type | Description |
427
- |-------|------|-------------|
428
- | `success` | `boolean` | Always `true` on success |
429
- | `path` | `string` | Absolute path to the written file |
430
-
431
- ### Side Effects
432
-
433
- - Creates `.nexus/state/artifacts/` if it does not exist.
434
- - Writes (or overwrites) `.nexus/state/artifacts/<filename>` with `content`.
435
-
436
- ### Error Conditions
437
-
438
- None declared at the tool level. Filesystem errors (permissions, disk full) will surface as unhandled exceptions.