opencode-conductor-plugin 1.7.0 → 1.8.1

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/dist/index.js CHANGED
@@ -3,9 +3,13 @@ import { newTrackCommand } from "./commands/newTrack.js";
3
3
  import { implementCommand } from "./commands/implement.js";
4
4
  import { statusCommand } from "./commands/status.js";
5
5
  import { revertCommand } from "./commands/revert.js";
6
- import { join } from "path";
6
+ import { join, dirname } from "path";
7
7
  import { homedir } from "os";
8
8
  import { existsSync, readFileSync } from "fs";
9
+ import { readFile } from "fs/promises";
10
+ import { fileURLToPath } from "url";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
9
13
  const ConductorPlugin = async (ctx) => {
10
14
  // Detect oh-my-opencode for synergy features
11
15
  const configPath = join(homedir(), ".config", "opencode", "opencode.json");
@@ -31,6 +35,60 @@ const ConductorPlugin = async (ctx) => {
31
35
  conductor_status: statusCommand(extendedCtx),
32
36
  conductor_revert: revertCommand(extendedCtx),
33
37
  },
38
+ "tool.execute.before": async (input, output) => {
39
+ // INTERCEPT: Sisyphus Delegation Hook
40
+ // Purpose: Automatically inject the full Conductor context (Plan, Spec, Workflow, Protocol)
41
+ // whenever the Conductor delegates a task to Sisyphus. This ensures Sisyphus has "Engineering Authority"
42
+ // without needing the LLM to manually copy-paste huge context blocks.
43
+ if (input.tool === "delegate_to_agent") {
44
+ const agentName = (output.args.agent_name || output.args.agent || "").toLowerCase();
45
+ if (agentName.includes("sisyphus")) {
46
+ console.log("[Conductor] Intercepting Sisyphus delegation. Injecting Context Packet...");
47
+ const conductorDir = join(ctx.directory, "conductor");
48
+ const promptsDir = join(__dirname, "prompts");
49
+ // Helper to safely read file content
50
+ const safeRead = async (path) => {
51
+ try {
52
+ if (existsSync(path))
53
+ return await readFile(path, "utf-8");
54
+ }
55
+ catch (e) { /* ignore */ }
56
+ return null;
57
+ };
58
+ // 1. Read Project Context Files
59
+ // We need to find the active track to get the correct spec/plan.
60
+ // Since we don't know the track ID easily here, we look for the 'plan.md' that might be in the args
61
+ // OR we just rely on the Conductor having already done the setup.
62
+ // WAIT: We can't easily guess the track ID here.
63
+ // BETTER APPROACH: We rely on the generic 'conductor/workflow.md' and 'prompts/implement.toml'.
64
+ // For 'spec.md' and 'plan.md', the Conductor usually puts the path in the message.
65
+ // However, to be robust, we will read the GLOBAL workflow and the IMPLEMENT prompt.
66
+ // We will explicitly inject the IMPLEMENT PROMPT as requested.
67
+ const implementToml = await safeRead(join(promptsDir, "implement.toml"));
68
+ const workflowMd = await safeRead(join(conductorDir, "workflow.md"));
69
+ // Construct the injection block
70
+ let injection = "\n\n--- [SYSTEM INJECTION: CONDUCTOR CONTEXT PACKET] ---\n";
71
+ injection += "You are receiving this task from the Conductor Architect.\n";
72
+ if (implementToml) {
73
+ injection += "\n### 1. ARCHITECTURAL PROTOCOL (Reference Only)\n";
74
+ injection += "Use this protocol to understand the project's rigorous standards. DO NOT restart the project management lifecycle (e.g. track selection).\n";
75
+ injection += "```toml\n" + implementToml + "\n```\n";
76
+ }
77
+ if (workflowMd) {
78
+ injection += "\n### 2. DEVELOPMENT WORKFLOW\n";
79
+ injection += "Follow these TDD and Commit rules precisely.\n";
80
+ injection += "```markdown\n" + workflowMd + "\n```\n";
81
+ }
82
+ injection += "\n### 3. DELEGATED AUTHORITY\n";
83
+ injection += "- **EXECUTE:** Implement the requested task using the Workflow.\n";
84
+ injection += "- **REFINE:** You have authority to update `plan.md` if it is flawed.\n";
85
+ injection += "- **ESCALATE:** If you modify the Plan or Spec, report 'PLAN_UPDATED' immediately.\n";
86
+ injection += "--- [END INJECTION] ---\n";
87
+ // Append to the objective
88
+ output.args.objective += injection;
89
+ }
90
+ }
91
+ }
34
92
  };
35
93
  };
36
94
  export default ConductorPlugin;
@@ -69,10 +69,17 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
69
69
 
70
70
  5. **Execute Tasks and Update Track Plan:**
71
71
  a. **Announce:** State that you will now execute the tasks from the track's `plan.md` by following the procedures in `workflow.md`.
72
- b. **OMO Delegation (Synergy Mode):** If `isOMOActive` is "true", you SHOULD consider yourself the Architect. Instead of implementing every code change yourself, you can call `@sisyphus` to handle the granular TDD loops for each task.
73
- - *Action:* For each task, announce: "Delegating implementation of task [Name] to Sisyphus."
74
- - *Action:* Call `@sisyphus` with the task description and reference the `spec.md` and `workflow.md`.
75
- - *Action:* Once Sisyphus completes the task, you verify it against the plan and move to the next.
72
+ b. **OMO Delegation (Synergy Mode):** If `isOMOActive` is "true", you act as the **Architect**.
73
+ - *Role:* You delegate the execution of tasks to **Sisyphus**.
74
+ - *System Note:* When you call `@sisyphus`, the system will automatically inject the full project context (Plan, Spec, Workflow, Protocol) for you.
75
+ - *Action:* For each task, call `@sisyphus` with this directive:
76
+ > "I am delegating the implementation of task: '[Task Name]' to you.
77
+ >
78
+ > **Goal:** Execute this task. You have Engineering Authority to update `plan.md` if needed.
79
+ > **Constraint:** If you modify the plan or spec, stop and report 'PLAN_UPDATED'."
80
+ - *Verification:*
81
+ - If Sisyphus reports 'PLAN_UPDATED', you MUST **reload** `plan.md` before proceeding.
82
+ - If Sisyphus reports success, verify the task against the plan and move to the next.
76
83
  c. **Manual Implementation (Standard Mode):** If `isOMOActive` is "false" or if you choose to implement directly, you MUST now loop through each task in the track's `plan.md` one by one.
77
84
  d. **For Each Task, You MUST:**
78
85
  i. **Defer to Workflow:** The `workflow.md` file is the **single source of truth** for the entire task lifecycle. You MUST now read and execute the procedures defined in the "Task Workflow" section of the `workflow.md` file you have in your context. Follow its steps for implementation, testing, and committing precisely.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-conductor-plugin",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "Conductor plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": "derekbar90/opencode-conductor",