opencode-work-context 0.15.0 → 0.17.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.
- package/README.md +57 -0
- package/commands/wc.md +78 -189
- package/package.json +1 -1
- package/plugin/stages-tui.js +12 -4
- package/plugin/work-context.js +11 -5
- package/src/command-help.js +185 -0
- package/src/core.js +202 -13
- package/src/dependency-handoffs.js +204 -0
- package/src/errors.js +3 -0
- package/src/index.js +1 -0
- package/src/integration-notices.js +65 -2
- package/src/protocol.js +3 -3
- package/src/stages-snapshot.js +5 -3
- package/src/storage.js +17 -1
- package/src/tool-definitions.js +8 -3
- package/src/work-context-snapshot.js +1 -0
- package/tools/work_context_add_stage_dependency.js +2 -0
- package/tools/work_context_delegate_stage.js +2 -0
- package/tools/work_context_publish_dependency_handoff.js +2 -0
- package/tools/work_context_read_dependency_context.js +2 -0
- package/tools/work_context_remove_stage_dependency.js +2 -0
package/README.md
CHANGED
|
@@ -70,6 +70,49 @@ only when the workspace Planning-stage prompt includes this standalone line:
|
|
|
70
70
|
AUTO_STAGE_FINISH: allowed
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
### Delegate Work Between Stages
|
|
74
|
+
|
|
75
|
+
An active working stage can atomically create a delegated stage and become
|
|
76
|
+
formally dependent on it:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/wc stage delegate 000001 02 "Research compatibility" "Return a verified compatibility finding" "Inspect the supported versions and run focused checks."
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The new stage receives a bounded delegation contract. The delegating stage
|
|
83
|
+
keeps its active session, but becomes blocked for resume and finish until the
|
|
84
|
+
new dependency reaches a lifecycle-satisfied state. Planning stage 01 cannot
|
|
85
|
+
participate in working-stage dependencies. Existing actionable stages can be
|
|
86
|
+
linked or unlinked explicitly with `stage dependency add` and `stage dependency
|
|
87
|
+
remove`; cycle checks and the repository transaction prevent partial graph
|
|
88
|
+
updates.
|
|
89
|
+
|
|
90
|
+
While work is still in progress, the active dependency stage may publish a
|
|
91
|
+
bounded intermediate result without finishing:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
/wc stage dependency publish 000001 03 "Compatibility is viable; browser coverage remains"
|
|
95
|
+
/wc stage dependency read 000001 02
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
An explicit `stage finish` publishes exactly one immutable final handoff to all
|
|
99
|
+
formal direct dependents. Handoffs contain only a concise outcome, explicit
|
|
100
|
+
committed candidate or commit evidence, verification, blockers, source and
|
|
101
|
+
target stages, and identity/timestamp fields. They never contain transcripts,
|
|
102
|
+
raw diffs, secrets, or an unbounded copy of another stage's execution state.
|
|
103
|
+
Updating a completed stage result later does not rewrite the historical final
|
|
104
|
+
handoff.
|
|
105
|
+
|
|
106
|
+
An already-active dependent receives a targeted one-time system notice before
|
|
107
|
+
its next model request. Resume context and expanded sidebar details provide the
|
|
108
|
+
durable fallback. Intermediate handoffs do not satisfy dependencies, and no
|
|
109
|
+
handoff advances Current, finishes a stage, starts downstream work, switches a
|
|
110
|
+
session, or submits an unsolicited prompt. Removing an edge retires its pending
|
|
111
|
+
delivery and current projection. Re-adding the same edge creates a new
|
|
112
|
+
generation, so old handoffs do not reappear. The bounded audit trail compacts
|
|
113
|
+
sufficiently old non-current records into a content-digest summary before
|
|
114
|
+
storage limits could block lifecycle work.
|
|
115
|
+
|
|
73
116
|
### Acknowledge A Manual Commit
|
|
74
117
|
|
|
75
118
|
When you commit shared in-progress work while an active stage is running, tell
|
|
@@ -276,6 +319,20 @@ mapping, storage safety, or explicit lifecycle rules. Implement executable
|
|
|
276
319
|
project extensions as separate project plugins rather than modifying generated
|
|
277
320
|
loaders.
|
|
278
321
|
|
|
322
|
+
The generated `/wc` command is intentionally a compact dispatcher. It keeps the
|
|
323
|
+
canonical command-to-tool catalog and universal safety rules in the always-loaded
|
|
324
|
+
prompt, then calls `work_context_help` with one exact command selector to load
|
|
325
|
+
only that operation's syntax and behavioral contract. If scoped help cannot
|
|
326
|
+
match a selector, mutating operations fail closed instead of guessing. This
|
|
327
|
+
keeps the slash-command prompt bounded while the loaded plugin remains the
|
|
328
|
+
versioned source of detailed command semantics.
|
|
329
|
+
|
|
330
|
+
Scoped help is a protocol-major contract: a compact dispatcher must be paired
|
|
331
|
+
with a plugin that reports `matched`, the canonical selector, exact tool mapping,
|
|
332
|
+
syntax, and operation guidance. Delivery doctor therefore rejects a compact
|
|
333
|
+
command paired with a pre-scoped-help plugin instead of treating that combination
|
|
334
|
+
as harmless minor drift.
|
|
335
|
+
|
|
279
336
|
Useful commands:
|
|
280
337
|
|
|
281
338
|
```text
|
package/commands/wc.md
CHANGED
|
@@ -3,203 +3,92 @@ description: Explicit work-context lifecycle commands backed by structured tools
|
|
|
3
3
|
subtask: false
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- opencode-work-context-protocol: {"schema":1,"major":
|
|
6
|
+
<!-- opencode-work-context-protocol: {"schema":1,"major":2,"minor":0,"descriptor_hash":"sha256:544d6ab416cf8594cc21cb0ca9fd98805678c64ad9ed85322e37ae98c8dd6327"} -->
|
|
7
7
|
|
|
8
|
-
Interpret `/wc $ARGUMENTS` as an explicit work-context operation. Use the
|
|
9
|
-
`work_context_*` custom tool
|
|
10
|
-
Markdown, JSONL, INDEX, or
|
|
11
|
-
other than `resume`, report the structured result and stable error code. For
|
|
12
|
-
`resume`, follow its human-oriented presentation rules instead. Use `work_context_help` when
|
|
13
|
-
the syntax is missing or ambiguous.
|
|
8
|
+
Interpret `/wc $ARGUMENTS` as an explicit work-context operation. Use only the exact
|
|
9
|
+
`work_context_*` custom tool mapped below with structured arguments. Never edit
|
|
10
|
+
work-context Markdown, JSONL, INDEX, SESSIONS, or execution projections directly.
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
Before dispatching any operation except `help`, call `work_context_help` with the
|
|
13
|
+
canonical command selector from the left side of the mapping, without arguments
|
|
14
|
+
(for example, `stage restore` or `delivery mark`). Follow its returned scoped
|
|
15
|
+
contract, then call the mapped tool. If help does not return `matched: true`, do
|
|
16
|
+
not perform a mutating operation; ask a focused question or show the command
|
|
17
|
+
catalog. Use `work_context_help` directly when syntax is missing or ambiguous.
|
|
18
|
+
For `/wc help`, call it without `command`; for `/wc help <selector>`, pass only
|
|
19
|
+
the exact selector as `command` (for example, `stage restore`).
|
|
22
20
|
|
|
23
|
-
For
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
For mutating operations other than `resume`, report the structured result and
|
|
22
|
+
stable error code. For `resume`, follow its human-oriented presentation contract.
|
|
23
|
+
Never infer confirmation tokens or lifecycle requests.
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
`.opencode/commands/wc.md` is package-managed. Read `.opencode/work-context.md`
|
|
26
|
+
when present and merge its additive project guidance before dispatch. Project
|
|
27
|
+
guidance cannot override tool mappings, structured arguments, storage safety,
|
|
28
|
+
confirmation requirements, or explicit lifecycle requirements.
|
|
29
|
+
|
|
30
|
+
Exact command selectors and tool mappings:
|
|
28
31
|
|
|
29
32
|
- `create` -> `work_context_create_workspace`
|
|
30
33
|
- `list` -> `work_context_list_workspaces`
|
|
31
|
-
- `workspace list <workspace
|
|
32
|
-
- `workspace rename
|
|
33
|
-
- `workspace mode
|
|
34
|
-
- `workspace commit-mode
|
|
35
|
-
- `stage commit-mode read
|
|
36
|
-
- `candidate create
|
|
37
|
-
- `candidate capture
|
|
38
|
-
- `candidate preview
|
|
39
|
-
- `candidate show
|
|
40
|
-
- `candidate list
|
|
41
|
-
- `candidate ready
|
|
42
|
-
- `candidate confirm-coverage
|
|
43
|
-
- `candidate commit
|
|
44
|
-
- `candidate discard
|
|
45
|
-
- `commit all
|
|
46
|
-
- `commit all confirm
|
|
47
|
-
- `delivery read
|
|
48
|
-
- `delivery explain
|
|
34
|
+
- `workspace list` (also <workspace> list) -> `work_context_workspace_list`
|
|
35
|
+
- `workspace rename` -> `work_context_rename_workspace`
|
|
36
|
+
- `workspace mode` -> `work_context_set_workspace_mode`
|
|
37
|
+
- `workspace commit-mode` -> `work_context_set_workspace_commit_mode`
|
|
38
|
+
- `stage commit-mode read` -> `work_context_read_effective_commit_mode`
|
|
39
|
+
- `candidate create` -> `work_context_create_candidate`
|
|
40
|
+
- `candidate capture` -> `work_context_capture_candidate`
|
|
41
|
+
- `candidate preview` -> `work_context_preview_candidate`
|
|
42
|
+
- `candidate show` -> `work_context_show_candidate`
|
|
43
|
+
- `candidate list` -> `work_context_list_candidates`
|
|
44
|
+
- `candidate ready` -> `work_context_ready_candidate`
|
|
45
|
+
- `candidate confirm-coverage` -> `work_context_confirm_candidate_coverage`
|
|
46
|
+
- `candidate commit` -> `work_context_commit_candidate`
|
|
47
|
+
- `candidate discard` -> `work_context_discard_candidate`
|
|
48
|
+
- `commit all` -> `work_context_inspect_commit_all`
|
|
49
|
+
- `commit all confirm` -> `work_context_commit_all`
|
|
50
|
+
- `delivery read` -> `work_context_read_delivery`
|
|
51
|
+
- `delivery explain` -> `work_context_explain_delivery`
|
|
49
52
|
- `delivery doctor` -> `work_context_doctor_delivery`
|
|
50
|
-
- `delivery mark
|
|
51
|
-
- `workspace finish
|
|
52
|
-
- `workspace reopen
|
|
53
|
-
- `resume
|
|
54
|
-
- `commited
|
|
55
|
-
- `stage force-close
|
|
53
|
+
- `delivery mark` -> `work_context_mark_delivery`
|
|
54
|
+
- `workspace finish` -> `work_context_workspace_finish`
|
|
55
|
+
- `workspace reopen` -> `work_context_reopen_workspace`
|
|
56
|
+
- `resume` -> `work_context_start_session`
|
|
57
|
+
- `commited` -> `work_context_acknowledge_commit`
|
|
58
|
+
- `stage force-close` -> `work_context_force_close_session`
|
|
56
59
|
- `profiles show` -> `work_context_show_capability_profiles`
|
|
57
|
-
- `profiles setup` ->
|
|
58
|
-
- `profiles reset` ->
|
|
59
|
-
- `stage add
|
|
60
|
-
- `stage
|
|
61
|
-
- `stage
|
|
62
|
-
- `stage
|
|
63
|
-
- `stage
|
|
64
|
-
- `stage
|
|
65
|
-
- `stage
|
|
66
|
-
- `stage
|
|
67
|
-
- `stage
|
|
68
|
-
- `stage
|
|
69
|
-
- `stage
|
|
70
|
-
- `stage
|
|
71
|
-
- `stage
|
|
72
|
-
- `stage
|
|
73
|
-
- `stage
|
|
74
|
-
- `stage
|
|
75
|
-
- `stage
|
|
76
|
-
- `stage
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- `
|
|
82
|
-
- `
|
|
83
|
-
- `
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
- `candidate capture <workspace> <candidateId> paths <path>...`
|
|
91
|
-
- `candidate capture <workspace> <candidateId> patch "patch"`
|
|
92
|
-
- `candidate preview <workspace> <candidateId>`
|
|
93
|
-
- `candidate show <workspace> <candidateId>`
|
|
94
|
-
- `candidate list <workspace>`
|
|
95
|
-
- `candidate ready <workspace> <candidateId>`
|
|
96
|
-
- `candidate confirm-coverage <workspace> <candidateId> stages <stage>... INTEGRATION_COVERAGE_CONFIRMED`
|
|
97
|
-
- `candidate commit <workspace> <candidateId> ["message"]`
|
|
98
|
-
- `candidate discard <workspace> <candidateId>`
|
|
99
|
-
- `commit all <workspace> ["message"] [stages <stage>...] [exclude <path>...]`
|
|
100
|
-
- `commit all confirm <workspace> <fingerprint> COMMIT_ALL_CONFIRMED ["message"] [stages <stage>...] [exclude <path>...]`
|
|
101
|
-
- `delivery read <workspace> [<environment>] [range <from> <to>]`
|
|
102
|
-
- `delivery explain <workspace> <from> <to> [findings JSON]`
|
|
103
|
-
- `delivery doctor`
|
|
104
|
-
- `delivery mark <workspace> <environment> <commit> DELIVERY_CONFIRMED`
|
|
105
|
-
- `workspace finish <workspace>`
|
|
106
|
-
- `workspace reopen <workspace> "reason"`
|
|
107
|
-
- `resume <workspace> <stage>`
|
|
108
|
-
- `commited <short-or-full-SHA>`
|
|
109
|
-
- `stage force-close <workspace> <stage> <sessionId> "reason" FORCE_CLOSE`
|
|
110
|
-
- `profiles show`
|
|
111
|
-
- `profiles setup`
|
|
112
|
-
- `profiles reset`
|
|
113
|
-
- `stage add [<workspace>] "title" ["prompt"] [execution <routine|implementation|architecture|security|review> depth <light|standard|deep>] [review <routine|implementation|architecture|security|review>]`
|
|
114
|
-
- `stage profiles [<workspace>] [<stage>] [execution <routine|implementation|architecture|security|review> depth <light|standard|deep>|clear] [review <routine|implementation|architecture|security|review|clear>]`
|
|
115
|
-
- `stage commit-mode [<workspace>] [<stage>] <manual|per_item|clear>`
|
|
116
|
-
- `stage profiles refresh <workspace> [<stage>] [--include-explicit]`
|
|
117
|
-
- `stage reopen <workspace> <stage> "reason"`
|
|
118
|
-
- `stage restore <workspace> <stage> "reason"`
|
|
119
|
-
- `stage rename [<workspace>] [<stage>] "title"`
|
|
120
|
-
- `stage update [<workspace>] [<stage>] "description"`
|
|
121
|
-
- `stage update-prompt [<workspace>] [<stage>] "prompt"`
|
|
122
|
-
- `stage update-result [<workspace>] [<stage>] "result"`
|
|
123
|
-
- `stage execution read [<workspace>] [<stage>]`
|
|
124
|
-
- `stage execution replace [<workspace>] [<stage>] <expectedRevision> "state JSON"`
|
|
125
|
-
- `stage execution update [<workspace>] [<stage>] <expectedRevision> "changes JSON"`
|
|
126
|
-
- `stage execution complete-current [<workspace>] [<stage>] <expectedRevision>`
|
|
127
|
-
- `stage archive [<workspace>] [<stage>]`
|
|
128
|
-
- `stage handoff [<workspace>] [<stage>]`
|
|
129
|
-
- `stage abandon [<workspace>] [<stage>]`
|
|
130
|
-
- `stage finish [<workspace>] [<stage>]`
|
|
131
|
-
- `<workspace> [<stage>] link-issue <URL>`
|
|
132
|
-
- `<workspace> [<stage>] unlink-issue <URL>`
|
|
133
|
-
- `session rename "summary"`
|
|
134
|
-
- `stage handoff [<workspace>] <stage>`
|
|
135
|
-
- `stage abandon [<workspace>] <stage>`
|
|
136
|
-
- `stage finish [<workspace>] <stage>` automatically reviews the Knowledge Base (`auto` by default)
|
|
137
|
-
- stage lifecycle commands may omit stage, using the current OpenCode session; with one numeric identifier, six digits mean workspace and one or two digits mean stage
|
|
138
|
-
- explicit workspace and stage positions accept canonical padded IDs or unpadded positive integers (`1..999999` and `1..99`); results and generated commands remain padded
|
|
139
|
-
- zero, signs, decimals, whitespace, overlong values, and other non-digit identifier forms are invalid; a lone unpadded workspace ID is not reinterpreted under the one-identifier rule
|
|
140
|
-
- `stage update-result` replaces an existing result and does not create a result for an unfinished stage
|
|
141
|
-
- Planning stage 01 is a continuously available coordination surface, not a prerequisite gate; implementation, research, review, and other working stages must never depend on it
|
|
142
|
-
- execution recommendations have two independent portable fields: capability (`routine`, `implementation`, `architecture`, `security`, `review`) and depth (`light`, `standard`, `deep`)
|
|
143
|
-
- when stage creation does not explicitly name capability and depth, infer both from title, description, prompt, dependencies, active workspace knowledge, and current execution state; pass `classification: inferred`; explicit user values pass `classification: explicit`
|
|
144
|
-
- core and read-only UI never infer classifications; do not use keyword heuristics, mutate during resume, or invent values when the stage prompt is not actionable
|
|
145
|
-
- `stage profiles` makes an explicit assignment; execution capability and depth are set or cleared together, omitted fields remain unchanged, and review remains optional metadata that does not control subagents or resolve a model
|
|
146
|
-
- `stage profiles refresh` re-evaluates actionable missing/inferred stages from their complete current context and applies all computed recommendations in one structured call; skip completed/archived stages and preserve explicit assignments unless `--include-explicit` was requested
|
|
147
|
-
- `capability_profiles.mode` in `.work-context/config.yaml` is `advisory` by default or `off`; off mode preserves metadata but omits profile presentation, resolution, and mapping warnings
|
|
148
|
-
- advisory mappings are layered depth-to-model labels: tracked project mappings in `.opencode/capability-profiles.json` override global mappings in `~/.config/opencode/capability-profiles.json`; invalid entries are ignored with bounded warnings and missing mappings resolve to `current model`
|
|
149
|
-
- `profiles setup` must use interactive questions for mode and light/standard/deep labels, apply mode and mappings in separate atomic structured calls, then offer to refresh unfinished stages; `profiles reset` requires explicit confirmation and removes mappings without changing stage metadata or mode
|
|
150
|
-
- expanded stage details show one unlabeled line `<capability> · <depth> · <model>`; review metadata is not displayed as a model recommendation
|
|
151
|
-
- capability recommendations never select a model or agent, create a replacement session, block resume, or persist mapping targets in tracked workspace data
|
|
152
|
-
- stage execution state preserves string-array section compatibility while exposing stable `{ id, text, details? }` identities in `items`; `text` is the compact label and optional `details` contains self-contained guidance. `current` is the first remaining item and `queued` contains later remaining items in order. `replace` accepts strings or structured items, while `update` accepts `add`, `remove`, and `edit` changes; use IDs for duplicate or reworded text, and set an edit's `details` to `null` to clear it
|
|
153
|
-
- read stage execution state first and pass its revision as `expectedRevision`; absent legacy state has revision `0`, and a stale mutation returns `EXECUTION_REVISION_CONFLICT` without changing newer state
|
|
154
|
-
- execution mutations require the active stage session, trim and deduplicate items, reject overlap between `completed` and `remaining`, and enforce bounded item counts, lengths, and serialized size
|
|
155
|
-
- update execution state after meaningful scope changes, decisions, substantial work, blockers, or verification changes and before handoff; do not update it for every trivial edit or tool call
|
|
156
|
-
- work only on Current by default. Do not combine Queued items into one change set unless the user explicitly asks to batch them
|
|
157
|
-
- after completing a meaningful Current item, read the latest revision and call `stage execution complete-current`; it atomically moves only Current to Completed and promotes the next queued item. Retain ordering and briefly report the transition in normal output
|
|
158
|
-
- workspace `commit_mode` is persistent checklist commit authorization with `manual` as the default and `per_item` as the only commit policy. A stage may override it or use `clear` to inherit. It does not make `stage execution complete-current` perform Git work.
|
|
159
|
-
- in effective `per_item` mode, immediately before each direct commit or candidate fallback, call `stage commit-mode read` and proceed only when it still returns `per_item`. This is an agent-policy preflight, not atomic Git enforcement. Define an explicit patch boundary, run relevant verification, and create a safe direct commit before complete-current. Candidate publication remains separate.
|
|
160
|
-
- in startup plus `per_item` mode, inspect pending candidates related to the current stage and assess direct publication first. Only a ready `exact` candidate explicitly related to the current stage may substitute when direct publication is unsafe but separable. An ordinary `shared_foundation` or `integration` candidate does not satisfy Current completion. The narrow exception is committed, confirmed integration coverage described below. Reconcile stale related candidate intent after a direct commit. A true patch or merge conflict, failed verification, or incoherent boundary is a blocker: record it and do not complete Current. Authorization never includes unrelated changes.
|
|
161
|
-
- `candidate confirm-coverage` is available only in a startup workspace for one ready `integration` candidate. It requires an explicit selection of 2-20 unique actionable stages, the exact `INTEGRATION_COVERAGE_CONFIRMED` token, effective `per_item` mode, and a Current item for every selected stage. It snapshots each selected stage's stable Current item ID and execution revision. `relatedStages` remains traceability-only and neither selects nor authorizes coverage.
|
|
162
|
-
- candidate publication revalidates confirmed coverage before any Git mutation. A changed Current item, execution revision, effective mode, or terminal stage returns `CANDIDATE_COVERAGE_STALE`; the candidate remains ready and no commit is created. A successful publication stores the durable coverage and commit SHA but never advances execution state or stage lifecycle. Each selected stage verifies its remaining integration result and calls `complete-current` separately.
|
|
163
|
-
- committed coverage remains visible for exactly the covered Current item, then disappears for that stage when that Current advances. An already-active, unambiguous native session receives one bounded system notice before its next model request. Inactive or new sessions receive the durable resume/sidebar coverage fallback. Coverage never repurposes prompts, turns, or attention signals.
|
|
164
|
-
- before discarding an existing exact draft in favor of an integration candidate, prove the integration replacement covers the exact draft's intended work through capture, preview, readiness, and, when it substitutes for multiple Current items, explicit coverage confirmation. Do not discard the exact draft based only on related-stage metadata.
|
|
165
|
-
- `resume` returns `resume.presentation` and `resume.context`; before doing any work, report a concise human-oriented summary in the user's language with the stage title, a plain-language Goal, previous progress when useful, and the immediate next action
|
|
166
|
-
- when the saved prompt contains several clear deliverables, add `In this stage we will` with 2-5 short outcome-oriented bullets derived only from the prompt, previous result, and workspace knowledge; do not invent scope, and omit this block for a small stage
|
|
167
|
-
- do not expose raw workspace/stage/session identifiers, ordinals, `ok` flags, or absent error codes in the user-facing resume summary
|
|
168
|
-
- `resume.context.workspace_knowledge` contains every active durable knowledge entry for the workspace; treat it as established shared context, and do not repeat earlier analysis unless an entry is incomplete, contradicted, or needs verification
|
|
169
|
-
- when stage execution state exists, `resume.context.execution_state` is the current stage-local operational checkpoint. Its structured `current` and `queued` fields identify the active item and its ordered backlog; Current details are explicit on resume while queued presentation remains compact. Continue from it without rewriting the original prompt, and never copy it automatically into workspace knowledge or unrelated stages
|
|
170
|
-
- Planning-stage resume may include `resume.context.delivery_context`, a bounded workspace-level summary of committed candidates and environment checkpoints; it is release coordination context, not stage ownership
|
|
171
|
-
- when the user asks how to deploy from Planning, inspect the exact commit range and the repository's own deployment documentation, scripts, infrastructure, migrations, container definitions, configuration examples, and CI; produce ordered prerequisites, deployment, verification, rollback, and unresolved blockers instead of assuming that push or one generic command is sufficient
|
|
172
|
-
- delivery planning must never persist secret values; mention only required secret or configuration names, ask one focused question when environment or baseline is ambiguous, and never mark delivery merely because commit, push, or CI succeeded
|
|
173
|
-
- an associated OpenCode session resumed in a `startup` workspace receives `resume.context.workflow_policy`; follow it as active agent policy. Under effective `manual` commit mode, a shared dirty worktree and concurrent stages are expected, stages do not own files or commits, and ready work should be captured promptly into an explicit candidate; once a coherent commit intent exists, create or refresh its draft candidate before switching stages or handing off; on resume inspect `resume.context.pending_candidates` before creating a duplicate or another commit boundary; prefer an `exact` candidate when safely separable, use `shared_foundation` when several stages use one coherent change, and use `integration` when intertwined changes form one reviewable and testable result; mixed provenance and complete files containing unrelated stage work are not reasons to require prior commits or stop; stop only for a concrete patch conflict, an incoherent candidate boundary, or failed required verification. Under effective `per_item` mode, use the direct-first and exact-related fallback policy above instead.
|
|
174
|
-
- standard-mode and unassociated core sessions do not receive startup policy; retain the existing conservative worktree behavior there
|
|
175
|
-
- after presenting the summary, continue work immediately when `resume.next_action` is `start_work`; do not ask for generic confirmation
|
|
176
|
-
- a stage may require confirmation only with an exact standalone `RESUME_CONFIRMATION: required` line in its saved prompt; when `resume.next_action` is `await_confirmation`, present the summary and wait before inspecting or modifying application code
|
|
177
|
-
- `create` enters the new workspace's Planning stage in the current OpenCode session only when that native session has no active or historical work-context stage affinity; otherwise it creates the workspace without rebinding the current OpenCode session
|
|
178
|
-
- `stage add` only creates a planned stage; it never starts a stage session or changes the invoking OpenCode session's current stage, regardless of whether that session is associated with a workspace. Enter the new stage later with an explicit `resume <workspace> <stage>` in a separate OpenCode session
|
|
179
|
-
- `resume` never rebinds the OpenCode session that invokes it: the first associated work-context stage becomes that native session's immutable affinity, and attempting to start any different stage must fail atomically with `CURRENT_OPENCODE_SESSION_ALREADY_ASSOCIATED`; open a separate OpenCode session for the requested stage. Handoff, close, finish, abandon, archive, workspace completion, stage reopen, and stage restore never transfer or clear affinity
|
|
180
|
-
- a repeated `resume` for the stage already associated with the current OpenCode session returns the existing typed `ACTIVE_SESSION_EXISTS` result and must not create a duplicate stage session
|
|
181
|
-
- read-only session diagnostics report a legacy active association that conflicts with the earliest historical affinity as `SESSION_ASSOCIATION_SPLIT_BRAIN`; preserve the earliest historical association as the presumed original affinity, explicitly hand off or close only the incorrect later active association, and never force-close the presumed original merely because the conflict exists
|
|
182
|
-
- while `SESSION_ASSOCIATION_SPLIT_BRAIN` is present, contextual mutations must fail closed when omitted identifiers are ambiguous; recovery must explicitly name both the incorrect workspace and stage before handoff or close
|
|
183
|
-
- `resume` returns `resume.next_action` and `resume.instruction`; begin or continue implementation when the stage prompt is non-empty unless it explicitly requires confirmation or contains an unresolved decision that genuinely blocks progress
|
|
184
|
-
- `commited` is intentionally spelled with one `t`. It is a deterministic light control-plane acknowledgement for a user-created current-HEAD commit in the active stage session. Call the structured tool directly and return its compact result without a second analysis response. It validates the supplied short or full SHA, attached branch, fast-forward checkpoint, and absence of Git operations; it never infers ownership or changes candidates.
|
|
185
|
-
- when `resume.next_action` is `ask_questions`, do not inspect or modify application code and ask the user focused questions needed to make the prompt actionable
|
|
186
|
-
- before `stage finish`, review durable findings: add new knowledge, update changed knowledge, supersede obsolete knowledge, or explicitly use `knowledgeReview=none` when the stage produced no durable findings; use `knowledgeReview=added` after ledger changes
|
|
187
|
-
- invoke `stage finish` only when the user explicitly requests that lifecycle command; do not infer the request from completed work, tests, or a final report
|
|
188
|
-
- automatic completion is allowed only when the current workspace's Planning-stage prompt contains an exact standalone line `AUTO_STAGE_FINISH: allowed`; otherwise leave the stage in progress and report that the work is ready for the user's lifecycle decision
|
|
189
|
-
- `stage finish` closes and completes only the current stage session; it never starts, resumes, or binds the same OpenCode session to a downstream stage
|
|
190
|
-
- `stage finish` always validates the Knowledge Base and returns total and active entry counts plus downstream unfinished stages for informational prompt review; do not begin a downstream stage until the user explicitly resumes it in a separate OpenCode session
|
|
191
|
-
- execution checklist state never finishes a stage; explicit `stage finish` reports remaining items, blockers, and pending verification as warnings and preserves the final execution record for history
|
|
192
|
-
- `stage reopen <workspace> <stage> "reason"` applies only to a completed stage, preserves its result and completion history, records the reason, changes it to `in_progress`, and does not start a session or affect downstream stages; use an explicit separate-session `resume` to work on it again
|
|
193
|
-
- `stage restore <workspace> <stage> "reason"` applies only to an archived stage and restores its saved pre-archive status. New archives preserve that status; legacy archives restore to `in_progress`. It records the reason, preserves stage content and results, does not start a session, and requires explicit separate-session `resume` when restored to `planned` or `in_progress`.
|
|
194
|
-
- `workspace reopen <workspace> "reason"` applies only to a completed workspace, changes it to `in_progress`, and records durable recovery history. Cancelled workspaces cannot be reopened.
|
|
195
|
-
- candidate operations require `startup` workflow mode and store metadata and patch payloads only under `.work-context/local/`; create accepts an optional strategy and related stages, which are normalized references for traceability only and never ownership or lifecycle; active candidates explicitly related to the resumed stage appear as bounded metadata in `resume.context.pending_candidates` and in expanded sidebar details; capture requires exactly one explicit list of complete paths or one Git unified patch and never infers stage ownership; commit requires a ready candidate, uses its stored message unless a non-empty override is supplied, serializes Git publication, bypasses hooks and signing, and never uses the ordinary Git index. Confirmed integration coverage is an additional startup-only, per-item contract; it does not broaden standard-mode candidates, manual mode, or `commit all`.
|
|
196
|
-
- `commit all` is an explicit two-phase repository-local integration operation available in standard and startup workspaces: first call inspection, report its included and excluded paths, traceability, proposed message, verification summary, and fingerprint, then wait for the user's exact `COMMIT_ALL_CONFIRMED` confirmation before calling publication with the same message, stages, exclusions, and fingerprint
|
|
197
|
-
- commit-all inspection is read-only and never treats stages as file ownership; user-selected stages are traceability and message context, paths without defensible attribution remain explicit, `exclude` leaves known unrelated work outside the patch, and an omitted message uses the diff-derived proposal
|
|
198
|
-
- commit-all publication re-inspects under the Git lock and returns `COMMIT_ALL_STALE_PLAN` when HEAD, patch content, exclusions, traceability, or message no longer match the confirmed fingerprint; never infer confirmation from tests, candidate readiness, preview success, or lifecycle state
|
|
199
|
-
- commit-all is bounded to the current Git root and never includes sibling or external repositories, nested repositories, submodules, local operational state, suspicious generated paths, or probable secrets; those exclusions remain visible in the structured result and work in another repository must be committed there independently
|
|
200
|
-
- delivery operations are mode-neutral local operational state and never execute deployment; `delivery read` without a range returns metadata only, exact Git inspection requires both immutable `from` and `to` hashes, and `delivery mark` requires the exact `DELIVERY_CONFIRMED` token only after the user confirms successful delivery to that environment
|
|
201
|
-
- `delivery explain` is strictly read-only, accepts findings as structured JSON data, inspects only the explicit immutable range, and preserves stable errors, contract version, completeness, and omission of recommendations when incomplete
|
|
202
|
-
- `delivery doctor` is strictly read-only, compares generated-command, declared, installed, self-reported, and host-attested or unavailable runtime evidence, and fails fast only when command and loaded-plugin protocol majors differ
|
|
203
|
-
- `knowledge list|add|update|supersede <workspace> ...`
|
|
60
|
+
- `profiles setup` -> `work_context_configure_capability_profiles`
|
|
61
|
+
- `profiles reset` -> `work_context_reset_capability_profiles`
|
|
62
|
+
- `stage add` -> `work_context_add_stage`
|
|
63
|
+
- `stage delegate` -> `work_context_delegate_stage`
|
|
64
|
+
- `stage dependency add` -> `work_context_add_stage_dependency`
|
|
65
|
+
- `stage dependency remove` -> `work_context_remove_stage_dependency`
|
|
66
|
+
- `stage dependency publish` -> `work_context_publish_dependency_handoff`
|
|
67
|
+
- `stage dependency read` -> `work_context_read_dependency_context`
|
|
68
|
+
- `stage profiles` -> `work_context_set_stage_profiles`
|
|
69
|
+
- `stage commit-mode` -> `work_context_set_stage_commit_mode`
|
|
70
|
+
- `stage profiles refresh` -> `work_context_refresh_stage_profiles`
|
|
71
|
+
- `stage reopen` -> `work_context_reopen_stage`
|
|
72
|
+
- `stage restore` -> `work_context_restore_stage`
|
|
73
|
+
- `stage rename` -> `work_context_rename_stage`
|
|
74
|
+
- `stage update` -> `work_context_update_stage`
|
|
75
|
+
- `stage update-prompt` -> `work_context_update_stage_prompt`
|
|
76
|
+
- `stage update-result` -> `work_context_update_stage_result`
|
|
77
|
+
- `stage execution read` -> `work_context_read_stage_execution`
|
|
78
|
+
- `stage execution replace` -> `work_context_replace_stage_execution`
|
|
79
|
+
- `stage execution update` -> `work_context_update_stage_execution`
|
|
80
|
+
- `stage execution complete-current` -> `work_context_complete_current`
|
|
81
|
+
- `stage archive` -> `work_context_archive_stage`
|
|
82
|
+
- `stage handoff` -> `work_context_handoff_stage`
|
|
83
|
+
- `stage abandon` -> `work_context_abandon_stage`
|
|
84
|
+
- `stage finish` -> `work_context_finish_stage`
|
|
85
|
+
- `link-issue` -> `work_context_link_issue`
|
|
86
|
+
- `unlink-issue` -> `work_context_unlink_issue`
|
|
87
|
+
- `session rename` -> `work_context_rename_session`
|
|
88
|
+
- `knowledge list` -> `work_context_list_knowledge`
|
|
89
|
+
- `knowledge add` -> `work_context_add_knowledge`
|
|
90
|
+
- `knowledge update` -> `work_context_update_knowledge`
|
|
91
|
+
- `knowledge supersede` -> `work_context_supersede_knowledge`
|
|
92
|
+
- `help` -> `work_context_help`
|
|
204
93
|
|
|
205
94
|
Arguments: $ARGUMENTS
|
package/package.json
CHANGED
package/plugin/stages-tui.js
CHANGED
|
@@ -53,6 +53,14 @@ const stageCoverageText = (stage) => {
|
|
|
53
53
|
const others = item.covered_stages.filter((covered) => covered !== stage.id);
|
|
54
54
|
return `Published Current: ${item.candidate} · ${item.commit_hash.slice(0, 8)}${others.length ? ` · also ${others.join(", ")}` : ""}`;
|
|
55
55
|
};
|
|
56
|
+
const stageHandoffText = (stage) => {
|
|
57
|
+
const context = stage.dependency_context;
|
|
58
|
+
if (!context) return null;
|
|
59
|
+
const state = context.blocked ? "blocked" : "satisfied";
|
|
60
|
+
if (!context.handoffs?.count) return `Dependencies: ${state}`;
|
|
61
|
+
const latest = context.handoffs.items[0];
|
|
62
|
+
return `Dependencies: ${state} · Handoff: ${latest.kind} from ${latest.source_stage}${context.handoffs.count > 1 ? ` · ${context.handoffs.count} total` : ""}`;
|
|
63
|
+
};
|
|
56
64
|
export const checklistSummaryText = (execution) => {
|
|
57
65
|
if (!execution) return null;
|
|
58
66
|
const done = execution.completed?.length || 0;
|
|
@@ -111,7 +119,7 @@ const renderStagesContent = (result, theme, runtime = defaultRuntime, attention,
|
|
|
111
119
|
stage.tracker_links?.length && `Tasks: ${stage.tracker_links.map(trackerLinkText).join(", ")}`,
|
|
112
120
|
stage.depends_on?.length && `Deps: ${formatStageIds(stage.depends_on)}`,
|
|
113
121
|
].filter(Boolean).join(" · ");
|
|
114
|
-
const metadata = showDependencies ? [recommendation, stage.commit_mode && `Commits: ${stage.commit_mode.replace("_", "-")} (override)`, stageMetadata, stageCandidateText(stage), stageCoverageText(stage), stage.current && checklistSummaryText(stage.execution)].filter(Boolean).join("\n") : "";
|
|
122
|
+
const metadata = showDependencies ? [recommendation, stage.commit_mode && `Commits: ${stage.commit_mode.replace("_", "-")} (override)`, stageMetadata, stageHandoffText(stage), stageCandidateText(stage), stageCoverageText(stage), stage.current && checklistSummaryText(stage.execution)].filter(Boolean).join("\n") : "";
|
|
115
123
|
const attentionSignal = attentionSummaryText(unread);
|
|
116
124
|
const onMouseDown = (event) => {
|
|
117
125
|
if (event?.button != null && event.button !== 0) return;
|
|
@@ -392,7 +400,7 @@ export const checklistOptions = (execution, width = 80) => {
|
|
|
392
400
|
: value;
|
|
393
401
|
const option = (value, section, index, title, category) => {
|
|
394
402
|
const entry = item(value, section, index);
|
|
395
|
-
return { title: title(entry.text), value: `execution-${entry.id}`, category, ...(entry.details ? {
|
|
403
|
+
return { title: title(entry.text), value: `execution-${entry.id}`, category, ...(entry.details ? { guidance: entry.details } : {}) };
|
|
396
404
|
};
|
|
397
405
|
const options = [];
|
|
398
406
|
const current = execution.current || structuredItems("remaining")[0];
|
|
@@ -445,10 +453,10 @@ export const openChecklistDialog = (api, result) => {
|
|
|
445
453
|
options: checklistOptions(current.execution, width),
|
|
446
454
|
onSelect: (option) => {
|
|
447
455
|
if (option.value === "close") api.ui.dialog.clear?.();
|
|
448
|
-
else if (option.
|
|
456
|
+
else if (option.guidance) api.ui.dialog.replace(() => api.ui.DialogSelect({
|
|
449
457
|
title: `Checklist details · ${option.title}`,
|
|
450
458
|
placeholder: "Details",
|
|
451
|
-
options: checklistDetailsOptions(option.
|
|
459
|
+
options: checklistDetailsOptions(option.guidance, width),
|
|
452
460
|
onSelect: (detailOption) => { if (detailOption.value === "back") showChecklist(); },
|
|
453
461
|
}));
|
|
454
462
|
},
|
package/plugin/work-context.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import { createToolDefinitions } from "../src/tool-definitions.js";
|
|
3
3
|
import { contextFor, runtimeSelfReport, titleFor } from "../src/opencode-adapter.js";
|
|
4
4
|
import { readTuiState } from "./tui-state.js";
|
|
5
|
-
import { appendIntegrationNotices, canAppendIntegrationNotices, consumeIntegrationNotices } from "../src/integration-notices.js";
|
|
5
|
+
import { appendDependencyNotices, appendIntegrationNotices, canAppendIntegrationNotices, consumeDependencyNotices, consumeIntegrationNotices } from "../src/integration-notices.js";
|
|
6
6
|
import { withLock } from "../src/storage.js";
|
|
7
7
|
|
|
8
8
|
export default async ({ client, directory, worktree }) => ({
|
|
@@ -19,13 +19,19 @@ export default async ({ client, directory, worktree }) => ({
|
|
|
19
19
|
if (!fs.existsSync(context.storage.root)) return;
|
|
20
20
|
const notices = withLock(context.storage.lockPath("write"), () => {
|
|
21
21
|
const finding = context.diagnoseSessionAssociations(sessionID).data.findings[0];
|
|
22
|
-
if (finding) return [];
|
|
22
|
+
if (finding) return { integration: [], dependency: [] };
|
|
23
23
|
const session = context.sessionByOpenCodeId(sessionID);
|
|
24
|
-
if (!session) return [];
|
|
24
|
+
if (!session) return { integration: [], dependency: [] };
|
|
25
25
|
const coverage = context.candidates().committedCoverageProjection(session.workspace).by_stage[session.stage]?.items || [];
|
|
26
|
-
|
|
26
|
+
const stages = context.listStages(session.workspace).data.stages;
|
|
27
|
+
const stage = stages.find((item) => item.stage === session.stage);
|
|
28
|
+
return {
|
|
29
|
+
integration: consumeIntegrationNotices(projectRoot, sessionID, { personalRoot: context.storage.personalRoot, coverage }),
|
|
30
|
+
dependency: consumeDependencyNotices(projectRoot, sessionID, { personalRoot: context.storage.personalRoot, records: context.handoffs().read(session.workspace).records, dependencies: stage?.depends_on || [], dependencyGenerations: Object.fromEntries((stage?.depends_on || []).map((dependency) => [dependency, stage.dependency_epochs?.[dependency]?.generation || 1])) }),
|
|
31
|
+
};
|
|
27
32
|
}, { owner: "work-context integration notice", session: sessionID });
|
|
28
|
-
appendIntegrationNotices(output.system, notices);
|
|
33
|
+
appendIntegrationNotices(output.system, notices.integration);
|
|
34
|
+
appendDependencyNotices(output.system, notices.dependency);
|
|
29
35
|
} catch {
|
|
30
36
|
// Local notice delivery is best effort and must not interrupt a model request.
|
|
31
37
|
}
|