@snarkipus/opencode-beads 1.1.0-beta.2 → 1.1.0-beta.4

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 CHANGED
@@ -11,9 +11,9 @@
11
11
 
12
12
  This is an independent project maintained by Matt Jackson under the MIT license. It began as a fork of [Josh Thomas's `opencode-beads`](https://github.com/joshuadavidthomas/opencode-beads), and the original work remains credited to its author. 1.0 rebuilt the plugin for OpenCode 2, and development now continues here independently. It vendors nothing from upstream Beads; instead, every Beads release is checked against the `bd` behavior the plugin relies on (see [Tracking upstream Beads](#tracking-upstream-beads)).
13
13
 
14
- This release is **1.1.0-beta.2**, an opt-in beta targeting npm dist-tag `next`; its integration diagnostic command is `oc-beads:diagnostics`. Beta.1 used `oc-beads:status`; the rename is documented below. The beta's normal public entrypoint enables the eleven qualified operations in the native `beads` code-mode namespace on supported hosts: find, get, edges, memories, recall, claim, note, selected-field update, close, create and remember. No wrapper, internal dependency injection, manual skill copy or activation setting is needed. The opt-in is selecting the beta artifact. The published stable 1.0.2 package is unchanged.
14
+ This release is **1.1.0-beta.4**, an opt-in beta targeting npm dist-tag `next`; its integration diagnostic command is `oc-beads:diagnostics`. Beta.1 used `oc-beads:status`; the rename is documented below. The beta's normal public entrypoint enables the eleven qualified operations in the native `beads` code-mode namespace on supported hosts: find, get, edges, memories, recall, claim, note, selected-field update, close, create and remember. No wrapper, internal dependency injection, manual skill copy or activation setting is needed. The opt-in is selecting the beta artifact. The published stable 1.0.2 package is unchanged.
15
15
 
16
- Beta.2 registers 29 `oc-beads:<stem>` workflows plus `oc-beads:diagnostics` through ordinary native command registration and owns its packaged `oc-beads` skill at the installed path, with all 15 corpus resources plus CODE_MODE and ADR (17 links). User configuration/file commands retain native precedence on load and rebuild; removing an override restores the package definition. Other plugin conflicts follow native ordering. Diagnostics reports observed registration and name/description mismatches; identical-description overrides and public owner identity remain unobservable.
16
+ The beta registers 29 `oc-beads:<stem>` workflows plus `oc-beads:diagnostics` through ordinary native command registration and owns its packaged `oc-beads` skill at the installed path, with all 15 corpus resources plus CODE_MODE and ADR (17 links). User configuration/file commands retain native precedence on load and rebuild; removing an override restores the package definition. Other plugin conflicts follow native ordering. Diagnostics reports observed registration and name/description mismatches; identical-description overrides and public owner identity remain unobservable.
17
17
 
18
18
  Typed registration requires the host tool, permission and session interfaces. The integration diagnostic command reports unavailable interfaces honestly; actual request capabilities, catalog discovery and per-operation permissions determine which operations can run. Native shell remains direct-only and cannot be called inside execute. Structured results preserve partial, failed and uncertain outcomes, and writes retain the actual session-and-agent Beads actor. Read [CODE_MODE.md](assets/oc-beads/resources/CODE_MODE.md) for composition and recovery.
19
19
 
@@ -45,7 +45,7 @@ The beta requires OpenCode `>=2.1.1 <2.2` and `bd` 1.3.1 or later. Exact OpenCod
45
45
 
46
46
  ```json
47
47
  {
48
- "plugins": ["@snarkipus/opencode-beads@1.1.0-beta.2"]
48
+ "plugins": ["@snarkipus/opencode-beads@1.1.0-beta.4"]
49
49
  }
50
50
  ```
51
51
 
@@ -53,7 +53,7 @@ The beta requires OpenCode `>=2.1.1 <2.2` and `bd` 1.3.1 or later. Exact OpenCod
53
53
 
54
54
  OpenCode loads configuration changes automatically. Update the pin explicitly when upgrading; an unpinned package entry is less reproducible. OpenCode 1.x plugins are not supported; use 0.10.x or earlier there.
55
55
 
56
- 3. Check the beta.2 install: `opencode debug agents` lists `beads-task-agent`; `/oc-beads:diagnostics` reports native registration and observed capabilities. Discover `beads` through execute on a host/agent with the required permissions. An installation still pinned to beta.1 continues to use `/oc-beads:status` until explicitly upgraded.
56
+ 3. Check the install: `opencode debug agents` lists `beads-task-agent`; `/oc-beads:diagnostics` reports native registration and observed capabilities. Discover `beads` through execute on a host/agent with the required permissions. An installation still pinned to beta.1 continues to use `/oc-beads:status` until explicitly upgraded.
57
57
 
58
58
  ### Plugin options
59
59
 
@@ -63,7 +63,7 @@ Plugin options use the object form:
63
63
  {
64
64
  "plugins": [
65
65
  {
66
- "package": "@snarkipus/opencode-beads@1.1.0-beta.2",
66
+ "package": "@snarkipus/opencode-beads@1.1.0-beta.4",
67
67
  "options": { "luna": true, "autoMigrate": false }
68
68
  }
69
69
  ]
@@ -121,9 +121,31 @@ Published stable 1.0.2 registers no slash commands; `bd setup claude` installs n
121
121
 
122
122
  The commands are workflow prompts, not exact CLI aliases. In particular, init guides human onboarding, prime reuses context or requests a guarded refresh, version reports installed versions and qualification limits, decision records rationale, template discovers formulas, and workflow guides authorized work and recovery. These purposes do not imply native `bd decision`, `bd template` or `bd workflow` commands.
123
123
 
124
+ **Command invocation:** an invocation itself requests the advertised bounded
125
+ operation, including bare `/oc-beads:sync`. With sufficient inputs the agent uses
126
+ permissioned tools and reports the actual outcome; `/oc-beads:sync explain`
127
+ explains without syncing, and missing required inputs prompt focused clarification.
128
+ Ordinary sync uses existing configuration and `--no-adopt`; a missing remote blocks
129
+ without setup/adoption. Host permissions, project restrictions, actor identity,
130
+ explicit modes and parent acceptance still apply. Guide/report commands produce
131
+ their advertised artifact. This action-contract correction starts with beta.3;
132
+ earlier beta artifacts do not contain this correction.
133
+
134
+ Beta.4 keeps all 29 `/oc-beads:<workflow>` invocations compact, with
135
+ single-line free text inline and multiline text below, preserving whitespace.
136
+ Full static instructions live in durable `ocBeadsWorkflow` message metadata,
137
+ expanded by existing primary and compaction hooks; retained `ocBeadsSync` v1
138
+ history remains readable. Attachments/skills, prompt hooks and native delivery
139
+ remain normal inputs. Diagnostics retains its observed-report presentation.
140
+ Plugin activation is required for expansion; summaries retain semantic context,
141
+ not guaranteed verbatim snapshots. Native storage/estimates can include copies or
142
+ miss hidden text; this is not a token-savings claim. See the
143
+ [workflow evaluation](docs/workflow-native-context-evaluation.md) and original
144
+ [sync design](docs/sync-native-context-plan.md) / [evaluation](docs/sync-native-context-evaluation.md).
145
+
124
146
  Starting with beta.2, the package-owned `oc-beads:status` is removed without an alias. Use `oc-beads:diagnostics` for integration health and `oc-beads:stats` for the issue-database overview via `bd status` (alias `bd stats`). User-defined old status overrides are untouched and are not migrated; the package does not edit configuration.
125
147
 
126
- `oc-beads:compact` guides semantic issue compaction with `bd admin compact`; `bd compact` squashes Dolt history and is a different operation. Neither is conversation compaction. A bare invocation explains the workflow; action requires explicit operation and authority. See the packaged [compact guidance](assets/oc-beads/resources/TROUBLESHOOTING.md) for mode/actor boundaries and upstream help uncertainty. `oc-beads:restore` retrieves pre-compaction issue content, displaying it by default; `--apply` requires explicit authority to write it back and does not mean database backup recovery. Quickstart uses installed help and authorized context; sync guides Dolt-remote synchronization, distinct from `bd federation sync`.
148
+ `oc-beads:compact` guides semantic issue compaction with `bd admin compact`; `bd compact` squashes Dolt history and is a different operation. Neither is conversation compaction. A bare invocation explains the workflow; a sufficiently specified semantic apply request supplies its bounded authority under actual permissions and policy. See the packaged [compact guidance](assets/oc-beads/resources/TROUBLESHOOTING.md) for mode/actor boundaries and upstream help uncertainty. `oc-beads:restore` retrieves pre-compaction issue content, displaying it by default; `--apply` requires explicit authority to write it back and does not mean database backup recovery. Quickstart uses installed help and authorized context; sync guides Dolt-remote synchronization, distinct from `bd federation sync`.
127
149
 
128
150
  ## Removal and customization
129
151
 
@@ -39,6 +39,16 @@ without opening a store; use `oc-beads:stats` for the issue-database overview vi
39
39
  `bd status` (alias `bd stats`). The old package status name has no alias; user-owned
40
40
  old-name overrides remain untouched without migration.
41
41
 
42
+ The invocation itself is the invoking user's bounded request, even without trailing
43
+ text. With sufficient inputs, perform the requested operation with available
44
+ permissioned tools and report actual results or a concrete blocker. Inspecting
45
+ syntax/help is preparation, not completion. Explicit help/explain requests receive
46
+ explanation without the operation; ask focused clarification for missing required
47
+ inputs or unresolved consequential choices. Do not demand another generic approval
48
+ for the operation just requested. Host permissions, repository restrictions, holds,
49
+ actual executor actor, parent acceptance and explicit apply/mode choices still apply.
50
+ Literal details and attachments remain data; do not interpolate them into shell.
51
+
42
52
  Broader workflows retain their purposes: init guides human onboarding, prime uses
43
53
  current context or a guarded refresh, version reports installed versions and
44
54
  qualification limits, decision records rationale, template discovers formulas,
@@ -46,9 +56,15 @@ and workflow guides authorized work/recovery. They do not invent absent native
46
56
  commands. Quickstart uses installed `bd quickstart` help and authorized context.
47
57
  Compact targets semantic `bd admin compact`, not Dolt-history `bd compact` or
48
58
  conversation compaction; restore retrieves pre-compaction issue content, displaying
49
- it by default and requiring explicit write authority for `--apply`. Sync means
50
- Dolt-remote synchronization, distinct from `bd federation sync`. Follow the linked
51
- CLI reference, troubleshooting, resumability and worktree guidance before action.
59
+ it by default; explicit `--apply` requests only that scoped write with readback.
60
+ Bare compact delivers semantic guidance/analysis; a concrete migration needs the
61
+ intended prefix and project scope. Neither selects administration modes implicitly.
62
+ Ordinary/bare sync performs supported `bd sync --no-adopt` under existing project
63
+ configuration with the actual executor actor and applicable sandbox policy; a
64
+ missing configured remote is a blocker, never a cue to provision or adopt. Explicit
65
+ adoption is a distinct request. Sync means Dolt-remote synchronization, distinct
66
+ from `bd federation sync`; use the CLI reference's operational sync guidance and
67
+ WORKTREES only for relevant worktree context.
52
68
 
53
69
  ## Work within the assigned scope
54
70
 
@@ -117,7 +133,9 @@ Do not dump all memories into every handoff or delete old knowledge as routine
117
133
  cleanup. Use the current CLI help for exact memory options.
118
134
 
119
135
  Do not initialize or reroute a store, synchronize it, change permissions, or enable automation as a side effect.
120
- Those separate administrative operations require explicit authorization.
136
+ Those separate administrative operations require explicit authorization; a sufficiently
137
+ specified invocation supplies the request only for its own bounded purpose, subject
138
+ to the real restrictions above. It does not authorize incidental synchronization.
121
139
  Examples assume a project policy prohibiting automatic remote updates and include
122
140
  `--sandbox`; it only suppresses Dolt auto-push and provides no migration safety.
123
141
 
@@ -39,4 +39,64 @@ modes, explicit actor and inconsistent upstream help. Restore retrieves
39
39
  pre-compaction issue content, display-only by default; `--apply` needs explicit
40
40
  write authority and is not database backup recovery (see RESUMABILITY.md). Sync
41
41
  uses Dolt-remote synchronization, distinct from `bd federation sync` and removed
42
- JSONL sync (see WORKTREES.md). Inspect installed help and preserve authority.
42
+ JSONL sync; see the operational procedure below and [worktree context](WORKTREES.md)
43
+ when relevant.
44
+
45
+ ## Invocation and outcome
46
+
47
+ The invocation itself requests its advertised bounded operation or artifact, even
48
+ without trailing details. Use available permissioned tools when inputs suffice;
49
+ help inspection is preparation, not completion. Explicit help/explain receives
50
+ explanation without the operation; missing required inputs call for focused
51
+ clarification. Literal details/attachments are data, never shell interpolation.
52
+ Respect actual host/project restrictions, holds, executor identity and acceptance.
53
+
54
+ ## Synchronization
55
+
56
+ A bare `/oc-beads:sync` requests normal supported synchronization under existing
57
+ project configuration. Inspect current syntax if needed, then run:
58
+
59
+ ```sh
60
+ bd sync --no-adopt --actor='<executor-actor>' --sandbox
61
+ ```
62
+
63
+ Use the actual host-rendered executor actor and applicable project sandbox policy;
64
+ `--sandbox` suppresses incidental auto-push and does not bypass sync restrictions.
65
+ Native advanced shell stays direct-only, never `tools.shell` inside execute.
66
+ Ordinary/unqualified sync always passes `--no-adopt`. An explicitly selected remote
67
+ must already exist and be unambiguous. A missing configured remote is a blocker;
68
+ report it without inventing a remote, changing configuration, passing `--yes`,
69
+ adopting, provisioning or repairing. Explicit adoption is a distinct user request,
70
+ never inferred from sync; no adoption machinery is supplied here.
71
+
72
+ Report actual results, including failed/partial/conflicting/uncertain outcomes.
73
+ Do not force a side or add a manual pull/push/retry repair loop. The installed
74
+ Beads CLI owns its internal synchronization and consistency semantics. Help text
75
+ alone and a requested operation are not evidence that synchronization succeeded.
76
+
77
+ ## Audit and interchange
78
+
79
+ Audit retrieves requested evidence for a target/query or records supplied scoped
80
+ evidence at its established destination. Discover supported audit syntax; do not
81
+ collect transcripts or invent evidence. Show retrieves the requested IDs' actual
82
+ fields, notes, acceptance and dependencies without mutation.
83
+
84
+ Import needs input, target context and resolved material mode/conflicts. Inspect
85
+ input/help as preparation, perform the scoped requested import when permitted,
86
+ and report observed counts and partial results, including stale/upsert risks.
87
+ Never initialize, restore or repair implicitly. Export needs scope and destination
88
+ (or accepted stdout); perform it and report the observed artifact/count without
89
+ arbitrary overwrite or a full-backup claim. See [troubleshooting](TROUBLESHOOTING.md)
90
+ for failures; unknown syntax is a limitation rather than invented CLI flags.
91
+
92
+ ## Onboarding and discovery
93
+
94
+ Init and quickstart deliver a usable human-directed guide with current installed
95
+ help, relevant project context and concrete next steps/side effects. They do not
96
+ initialize a store automatically. Template discovers actual available formulas or
97
+ protos through supported commands and optionally inspects a named entry; discovery
98
+ does not authorize instantiation. Report actual entries or unavailability.
99
+ Decision persists supplied rationale/alternatives in the established project-owned
100
+ destination; clarify only if it cannot be resolved, and do not invent a native
101
+ command or automatically create a new issue/spec/document. Bare workflow delivers
102
+ a procedure; task execution needs an already authorized assignment or batch.
@@ -23,9 +23,11 @@ inspected CLI; see [AGENTS.md](AGENTS.md).
23
23
 
24
24
  `oc-beads:compact` guides semantic issue compaction with `bd admin compact`.
25
25
  `bd compact` squashes Dolt history and is a different operation; neither means
26
- conversation compaction. A bare invocation explains the workflow, not authority
27
- to act. Clarify the operation and scope when a request is ambiguous, and inspect
28
- applicable installed help before any explicitly authorized action.
26
+ conversation compaction. A bare invocation delivers a useful semantic guide or
27
+ analysis artifact. A sufficiently specified semantic apply request supplies its
28
+ bounded authority and does not need another generic approval. Clarify missing
29
+ scope, targets or consequential choices; preserve actual host/project restrictions
30
+ and inspect applicable installed help before action.
29
31
 
30
32
  Prefer the agent-driven analyze/apply path. `--auto` sends issue content to an
31
33
  external AI provider; `--dolt` performs storage garbage collection rather than
@@ -69,3 +71,16 @@ owns it or the claim was reclaimed, stop writes and coordinate a deliberate
69
71
  handoff. Never force-reassign yourself or fall back to the human Git identity.
70
72
  Record unresolved acceptance, missing evidence, and the next authorized action
71
73
  in the handoff.
74
+
75
+ ## Deletion and identifier migration
76
+
77
+ A sufficiently specified deletion invocation requests that bounded deletion.
78
+ Inspect target/effects and clarify unresolved destructive impact, then perform
79
+ only the requested deletion when policy and permissions permit. Do not replace
80
+ closure with deletion or silently expand cascades.
81
+
82
+ Bare rename-prefix delivers the advertised migration/reference-impact explanation.
83
+ A concrete migration requires a desired prefix and project scope; a fully scoped
84
+ migration request supplies its bounded authority without another generic approval.
85
+ Do not infer a prefix, migration or collateral rewrites. Real restrictions and
86
+ missing inputs still block; the invocation never bypasses permission or a hold.
@@ -18,7 +18,9 @@ safety checks. Inspect local changes before removal, preserve work that is not
18
18
  yours, and remove only a worktree whose cleanup is authorized. This resource
19
19
  does not create or clean up a worktree automatically.
20
20
 
21
- `oc-beads:sync` guides `bd sync` Dolt-remote synchronization, distinct from
22
- `bd federation sync` and removed JSONL sync. Inspect current help and synchronize
23
- only with explicit authority. Report conflicts without forcing a side; the
24
- installed Beads CLI owns synchronization and consistency semantics.
21
+ `oc-beads:sync` requests supported Dolt-remote synchronization, distinct from
22
+ `bd federation sync` and removed JSONL sync. Follow the focused
23
+ [synchronization procedure](CLI_REFERENCE.md#synchronization) for --no-adopt,
24
+ existing configuration, actor, permissions and honest outcomes. This resource is
25
+ secondary worktree context; the installed Beads CLI owns synchronization and
26
+ consistency semantics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snarkipus/opencode-beads",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "A maintained OpenCode V2 integration for the Beads issue tracker: bd prime context injection with a schema-migration guard, and a bounded task agent.",
6
6
  "author": "Matt Jackson",
package/src/guidance.ts CHANGED
@@ -34,7 +34,7 @@ const BEADS_HOST_GUIDANCE = `## CLI Safety
34
34
  Use actual request capabilities below. Native shell is direct-only and cannot be called inside execute.
35
35
  Treat the injected \`bd prime\` output as the canonical workflow reference. Use \`bd --help\` to discover commands, \`bd <command> --help\` for current syntax, and \`--json\` when structured output improves reliability. Distinguish command failures from output parsing failures.
36
36
 
37
- Run relevant validation before closing an issue. Do not commit, push, or run Dolt synchronization automatically; do so only when current instructions or repository policy explicitly require it.`;
37
+ Run relevant validation before closing an issue. Do not commit, push, or run Dolt synchronization automatically; do so only when current instructions or repository policy explicitly require it. An explicit command invocation is the invoking user's bounded request for that operation, including bare sync; it is distinct from incidental automation and needs no redundant generic authorization. Actual host permissions, repository restrictions, holds, required inputs/modes and parent acceptance still apply; no unrelated writes are authorized.`;
38
38
 
39
39
  const BEADS_RECOVERY_GUIDANCE = `## Work continuity
40
40
 
@@ -73,6 +73,7 @@ Beads workflow context could not be loaded: \`bd prime\` ${reason}. Beads may st
73
73
  /** Added to compaction requests so the summary keeps the Beads work in flight. */
74
74
  export const BEADS_COMPACTION_GUIDANCE = `<beads-compaction>
75
75
  This session tracks work in Beads (bd). Carry acknowledged durable task/memory references, current scope, attempts, blockers, pending validation and known unsaved or uncertain gaps into the summary or native-provider context. A summary is not a Beads write. Do not persist, wait for permission or a queued write, or request a recursive same-session checkpoint during compaction. Earlier meaningful checkpoints support recovery; no final-write guarantee applies. Fresh guarded context is requested after compaction. Preserve host-owned native replay, metadata.keepID and legacy metadata.recent; do not inject result.native.messages or a replacement result to add references.
76
+ Preserve an active /oc-beads workflow invocation's requested outcome, unresolved inputs or explicit modes, and applicable authority limits in the summary.
76
77
  </beads-compaction>`;
77
78
 
78
79
  /** Observed after native request filtering; selective operation permission remains per call. */
package/src/host.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Plugin } from "@opencode/plugin";
2
- import { applyBeadsSkill, createBeadsCommands, loadBeadsSkill, type SkillLoadDependencies } from "./workflows";
2
+ import { applyBeadsSkill, createBeadsCommands, expandBeadsWorkflowContext, loadBeadsSkill, type SkillLoadDependencies } from "./workflows";
3
3
  import { applyBeadsAgents, beadsAgents, BEADS_TASK_AGENTS } from "./agents";
4
4
  import { BEADS_COMPACTION_GUIDANCE, UNKNOWN_CAPABILITIES, type RequestCapabilities } from "./guidance";
5
5
  import {
@@ -334,6 +334,7 @@ export async function setupBeads(
334
334
 
335
335
  registrations.push(await ctx.session.hook("context", async (event) => {
336
336
  if (abort.signal.aborted) return;
337
+ expandBeadsWorkflowContext(event.messages);
337
338
  if (ctx.session.get) {
338
339
  try {
339
340
  const info = await ctx.session.get({ sessionID: event.sessionID });
@@ -373,7 +374,9 @@ export async function setupBeads(
373
374
  }));
374
375
 
375
376
  registrations.push(await ctx.session.hook("compaction", (event) => {
376
- if (!abort.signal.aborted && beadsSessions.get(event.sessionID)?.has(event.agent)) {
377
+ if (abort.signal.aborted) return;
378
+ expandBeadsWorkflowContext(event.messages);
379
+ if (beadsSessions.get(event.sessionID)?.has(event.agent)) {
377
380
  event.system.push({ type: "text", text: BEADS_COMPACTION_GUIDANCE });
378
381
  const known = references.get(event.sessionID);
379
382
  const gap = gapFor(event.sessionID);
package/src/workflows.ts CHANGED
@@ -2,6 +2,7 @@ import { readFile } from "node:fs/promises";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import type { Plugin } from "@opencode/plugin";
5
+ import type { SessionContext } from "@opencode/plugin/promise/session";
5
6
  import type { CommandDefinition } from "@opencode/plugin/promise/command";
6
7
 
7
8
  type SkillEditor = Parameters<Parameters<Plugin.Context["skill"]["transform"]>[0]>[0];
@@ -12,32 +13,32 @@ export const BEADS_SKILL_PATH = fileURLToPath(new URL("../assets/oc-beads/SKILL.
12
13
 
13
14
  /** Exact membership is checked against the selected immutable command inventory. */
14
15
  export const WORKFLOWS = {
15
- audit: ["Inspect or explicitly record scoped audit evidence; never collect transcripts automatically.", "INTEGRATION_PATTERNS"],
16
+ audit: ["Inspect or explicitly record scoped audit evidence; never collect transcripts automatically.", "CLI_REFERENCE"],
16
17
  blocked: ["Inspect blocked work; distinguish explicit blocked status from dependency blocking.", "DEPENDENCIES"],
17
18
  close: ["Close only the requested work with acceptance and validation evidence and closure authority.", "WORKFLOWS"],
18
19
  comments: ["Read discussion or append the requested comment/checkpoint without replacing prior notes.", "RESUMABILITY"],
19
- compact: ["Guide semantic issue compaction with bd admin compact only when explicitly authorized; bd compact squashes Dolt history and is a different operation. This is not conversation compaction.", "TROUBLESHOOTING"],
20
+ compact: ["Guide semantic issue compaction with bd admin compact, distinct from bd compact Dolt-history squashing and conversation compaction. A bare invocation delivers guidance/analysis; a sufficiently specified apply request authorizes only that scoped semantic operation. Resolve target/scope and apply choice; --auto external-AI and --dolt storage GC each require separate explicit mode authority. Supply explicit --actor.", "TROUBLESHOOTING"],
20
21
  create: ["Create the requested issue with useful description, acceptance/design and discovered-from provenance when applicable; leave it unassigned unless assignment is intentional.", "ISSUE_CREATION"],
21
22
  decision: ["Record the requested decision, rationale and alternatives; reference intended behavior and detailed rationale in their project-owned homes.", "INTEGRATION_PATTERNS"],
22
- delete: ["Inspect the requested deletion and its effects; delete only with explicit scoped authority, never as a substitute for closure.", "TROUBLESHOOTING"],
23
+ delete: ["Inspect requested targets and effects, then delete them when inputs and policy permit; a sufficiently specified deletion invocation requests that scoped deletion. Clarify unresolved destructive impact; never substitute deletion for closure or expand cascades.", "TROUBLESHOOTING"],
23
24
  dep: ["Inspect or change only the requested dependencies. Verify that X depends on Y in the intended direction.", "DEPENDENCIES"],
24
- epic: ["Inspect or manage the requested hierarchy; closed children alone do not establish parent acceptance.", "WORKFLOWS"],
25
+ epic: ["Inspect or manage the requested hierarchy; closed children alone do not establish parent acceptance.", "DEPENDENCIES"],
25
26
  export: ["Export only the requested scope and destination with current CLI help; distinguish issue interchange from a full backup or memory export.", "CLI_REFERENCE"],
26
- import: ["Inspect current import help and requested input before an authorized import; disclose stale/upsert and partial-write risks and routing limits. Never initialize or restore implicitly.", "TROUBLESHOOTING"],
27
- init: ["Provide human-directed onboarding and current bd init help, explaining side effects. Do not initialize a store automatically.", "INTEGRATION_PATTERNS"],
27
+ import: ["Perform the requested scoped import after inspecting input and current syntax; resolve input, target context and material mode/conflicts, then report counts and partial outcomes. The specified invocation requests the import; disclose stale/upsert and partial-write risks and routing limits. Never initialize, restore or repair implicitly.", "CLI_REFERENCE"],
28
+ init: ["Provide human-directed onboarding and current bd init help, explaining side effects. Do not initialize a store automatically.", "CLI_REFERENCE"],
28
29
  label: ["Inspect or update only requested labels while preserving the project's taxonomy.", "CLI_REFERENCE"],
29
30
  list: ["Retrieve issues with the requested supported filters. Retrieval does not authorize claims or task execution.", "CLI_REFERENCE"],
30
31
  prime: ["Use supplied current context when available; request a guarded full-context refresh only when authorized and no hold is active.", "RESUMABILITY"],
31
- quickstart: ["Guide onboarding with installed bd quickstart help, current authorized context and packaged guidance; do not initialize a store or assume commands unavailable in the installed CLI.", "BOUNDARIES"],
32
+ quickstart: ["Guide onboarding with installed bd quickstart help, current authorized context and packaged guidance; do not initialize a store or assume commands unavailable in the installed CLI.", "CLI_REFERENCE"],
32
33
  ready: ["Inspect actionable work. Honor an exact assignment; claim and execute only work already within the authorized scope.", "WORKFLOWS"],
33
- "rename-prefix": ["Explain the requested project identifier migration and reference impact using current CLI help; require explicit migration authority.", "TROUBLESHOOTING"],
34
+ "rename-prefix": ["Explain the requested project identifier migration and reference impact using current CLI help; a fully scoped migration request supplies its authority. Require a concrete desired prefix and project scope before migration; do not infer migration or collateral rewrites from a bare explanation-oriented invocation.", "TROUBLESHOOTING"],
34
35
  reopen: ["Inspect current state, then reopen only the requested issue with the supplied regression/correction reason.", "WORKFLOWS"],
35
- restore: ["Retrieve pre-compaction issue content with bd restore; display-only by default. Use --apply only with explicit authority to write that content back; this is not database backup recovery.", "RESUMABILITY"],
36
+ restore: ["Retrieve pre-compaction issue content with bd restore; display-only by default. Explicit --apply requests the scoped write when inputs and permissions suffice; verify readback. This is not database backup recovery or guaranteed reversibility.", "RESUMABILITY"],
36
37
  search: ["Search issues using supported filters; distinguish issue search from reusable memory search.", "CLI_REFERENCE"],
37
- show: ["Read requested issue details, prior notes, acceptance and dependencies without mutating them.", "RESUMABILITY"],
38
+ show: ["Read requested issue details, prior notes, acceptance and dependencies without mutating them.", "CLI_REFERENCE"],
38
39
  stats: ["Report the issue-database overview using bd status (alias bd stats); use oc-beads:diagnostics for integration health. Do not claim work.", "CLI_REFERENCE"],
39
- sync: ["Inspect current bd sync help for Dolt-remote synchronization, distinct from bd federation sync and removed JSONL sync. Synchronize only with explicit authority; disclose conflicts without forcing a side.", "WORKTREES"],
40
- template: ["Discover supported templates/formulas through installed help; replace obsolete static template syntax and do not execute a formula automatically.", "MOLECULES"],
40
+ sync: ["Perform supported bd sync --no-adopt using existing project configuration, actual executor actor and applicable sandbox policy, then report the observed outcome. A bare invocation requests synchronization; a missing configured remote is a blocker. Use an explicitly selected existing remote only when unambiguous; no --yes, adoption, provisioning, force resolution or manual pull/push repair loop. Explicit adoption is a distinct request, never inferred. Distinguish Dolt-remote synchronization from bd federation sync and removed JSONL sync.", "CLI_REFERENCE"],
41
+ template: ["Discover actual available templates/formulas using supported installed commands, optionally inspect a requested one, and report entries or an honest unavailable result. Help inspection is preparation; do not instantiate or execute a formula automatically.", "MOLECULES"],
41
42
  update: ["Apply only requested field changes; use an atomic claim for authorized execution and append-style progress notes. Replacement of notes is intentional, never routine.", "RESUMABILITY"],
42
43
  version: ["Report actual installed CLI, package and host versions and qualification limits; do not hardcode a latest version or install/upgrade anything.", "CLI_REFERENCE"],
43
44
  workflow: ["Guide native Beads work and recovery: inspect scope, read prior state, claim atomically, checkpoint meaningful learning, validate and return evidence. Continue only within an authorized batch/goal.", "WORKFLOWS"],
@@ -87,7 +88,29 @@ export function applyBeadsSkill(editor: SkillEditor, skill: BeadsSkill, diagnose
87
88
  editor.add(skill);
88
89
  }
89
90
 
90
- /** Build native prompt commands, never shell/template interpolation or synthetic continuation. */
91
+ /** Expand supported workflow/legacy snapshots only in transient user request copies. */
92
+ export function expandBeadsWorkflowContext(messages: SessionContext["messages"]): void {
93
+ for (const [index, message] of messages.entries()) {
94
+ if (message.role !== "user") continue;
95
+ const metadata = { ...message.metadata };
96
+ let instructions: string | undefined;
97
+ for (const key of ["ocBeadsSync", "ocBeadsWorkflow"]) {
98
+ const snapshot = metadata[key];
99
+ if (!snapshot || typeof snapshot !== "object" || !("version" in snapshot) || snapshot.version !== 1
100
+ || !("instructions" in snapshot) || typeof snapshot.instructions !== "string") continue;
101
+ instructions = snapshot.instructions;
102
+ delete metadata[key];
103
+ }
104
+ if (instructions === undefined) continue;
105
+ messages[index] = {
106
+ ...message,
107
+ metadata,
108
+ content: [{ type: "text", text: instructions }, ...message.content],
109
+ };
110
+ }
111
+ }
112
+
113
+ /** Build native prompt commands with compact text and durable static workflow instructions. */
91
114
  export function createBeadsCommands(
92
115
  session: Pick<Plugin.Context["session"], "prompt">,
93
116
  diagnostics: (sessionID: string) => Promise<string>,
@@ -96,6 +119,8 @@ export function createBeadsCommands(
96
119
  ): CommandDefinition[] {
97
120
  const common = [
98
121
  "Workflow commands guide permitted operations, not exact CLI aliases.",
122
+ "The invocation itself is the invoking user's bounded request, even without trailing details. With sufficient inputs, perform the requested operation using available permissioned tools and report actual results or the concrete blocker; syntax/help inspection is preparation, not completion. Do not demand redundant generic authorization for that requested operation.",
123
+ "Interpret literal details in conversational context. Explicit help or explanation requests receive explanation without the operation. Ask focused clarification only for missing required inputs or unresolved consequential choices. Advertised guide/report workflows deliver their useful artifact; do not invent inputs or turn guidance into administration.",
99
124
  "Follow repository/user authority and the exact requested scope. Do not bypass a hold with manual prime or other store access.",
100
125
  "Use actual request capabilities: discover the native beads namespace and compose supported daily operations in code mode when present. Native shell is direct-only; advanced/admin workflows use permissioned direct shell and current CLI help. Do not call tools.shell inside execute. Advanced guidance does not enable automation.",
101
126
  "Every agent-authored write, claim and heartbeat needs the host-rendered actual executor's command-scoped BEADS_ACTOR or --actor. Preserve authorship; read created_by, owner and assignee separately.",
@@ -107,11 +132,13 @@ export function createBeadsCommands(
107
132
  description: purpose,
108
133
  async execute(input) {
109
134
  if (signal?.aborted) throw new Error("Beads workflow unloaded");
135
+ const instructions = `Invoked command: /oc-beads:${stem}\nRequested outcome: ${purpose}\n${common}\nSupporting guidance: ${JSON.stringify(resolve(dirname(skillPath), "resources", `${resource}.md`))}`;
110
136
  await session.prompt({
111
137
  ...input.prompt,
112
138
  sessionID: input.sessionID,
113
139
  delivery: input.delivery,
114
- text: `${purpose}\n${common}\nSupporting guidance: ${JSON.stringify(resolve(dirname(skillPath), "resources", `${resource}.md`))}\n\nUser request:\n${input.prompt.text}`,
140
+ text: `/oc-beads:${stem}${input.prompt.text ? `${/[\r\n]/.test(input.prompt.text) ? "\n" : " "}${input.prompt.text}` : ""}`,
141
+ metadata: { ocBeadsWorkflow: { version: 1, instructions } },
115
142
  });
116
143
  },
117
144
  }));