@kodrunhq/opencode-autopilot 1.6.0 → 1.9.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 +8 -8
- package/bin/cli.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/installer.ts +16 -2
- package/src/orchestrator/arena.ts +31 -0
- package/src/orchestrator/handlers/architect.ts +2 -2
- package/src/orchestrator/skill-injection.ts +3 -3
- package/src/tools/doctor.ts +1 -1
- package/src/tools/orchestrate.ts +8 -9
- package/src/tools/quick.ts +3 -3
- package/assets/commands/oc-configure.md +0 -27
- /package/assets/commands/{brainstorm.md → oc-brainstorm.md} +0 -0
- /package/assets/commands/{new-agent.md → oc-new-agent.md} +0 -0
- /package/assets/commands/{new-command.md → oc-new-command.md} +0 -0
- /package/assets/commands/{new-skill.md → oc-new-skill.md} +0 -0
- /package/assets/commands/{quick.md → oc-quick.md} +0 -0
- /package/assets/commands/{review-pr.md → oc-review-pr.md} +0 -0
- /package/assets/commands/{stocktake.md → oc-stocktake.md} +0 -0
- /package/assets/commands/{tdd.md → oc-tdd.md} +0 -0
- /package/assets/commands/{update-docs.md → oc-update-docs.md} +0 -0
- /package/assets/commands/{write-plan.md → oc-write-plan.md} +0 -0
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ The AI walks you through installation, model assignment for each agent group, an
|
|
|
42
42
|
bunx @kodrunhq/opencode-autopilot install
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
This registers the plugin in `opencode.json` and creates a starter config. Then
|
|
45
|
+
This registers the plugin in `opencode.json` and creates a starter config. Then run `bunx @kodrunhq/opencode-autopilot configure` to set up your model assignments.
|
|
46
46
|
|
|
47
47
|
### Option C: Manual setup
|
|
48
48
|
|
|
@@ -60,7 +60,7 @@ npm install -g @kodrunhq/opencode-autopilot
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Launch OpenCode. The plugin auto-installs agents, skills, and commands on first load and shows a welcome toast
|
|
63
|
+
Launch OpenCode. The plugin auto-installs agents, skills, and commands on first load and shows a welcome toast.
|
|
64
64
|
|
|
65
65
|
### Verify your setup
|
|
66
66
|
|
|
@@ -72,7 +72,7 @@ This checks config health, model assignments, and adversarial diversity between
|
|
|
72
72
|
|
|
73
73
|
## Model Groups
|
|
74
74
|
|
|
75
|
-
Agents are organized into 8 groups by the type of thinking they do. Each group gets a primary model and fallback chain.
|
|
75
|
+
Agents are organized into 8 groups by the type of thinking they do. Each group gets a primary model and fallback chain. Run `bunx @kodrunhq/opencode-autopilot configure` to assign models interactively. For advanced use, the `oc_configure` tool is also available in-session.
|
|
76
76
|
|
|
77
77
|
| Group | Agents | What they do | Model recommendation |
|
|
78
78
|
|-------|--------|-------------|---------------------|
|
|
@@ -203,22 +203,22 @@ The plugin ships with production-ready assets that auto-install to `~/.config/op
|
|
|
203
203
|
| Type | Assets | Purpose |
|
|
204
204
|
|------|--------|---------|
|
|
205
205
|
| **Agents** | researcher, metaprompter, documenter, pr-reviewer, autopilot + 10 pipeline agents | Research, docs, PR review, full autonomous pipeline |
|
|
206
|
-
| **Commands** | `/oc-
|
|
206
|
+
| **Commands** | `/oc-brainstorm`, `/oc-tdd`, `/oc-quick`, `/oc-write-plan`, `/oc-stocktake`, `/oc-review-pr`, `/oc-update-docs`, `/oc-new-agent`, `/oc-new-skill`, `/oc-new-command` | Brainstorming, TDD, quick tasks, planning, auditing, PR reviews, docs, extend plugin |
|
|
207
207
|
| **Skills** | coding-standards | Universal best practices (naming, error handling, immutability, validation) |
|
|
208
208
|
|
|
209
209
|
### In-session creation
|
|
210
210
|
|
|
211
211
|
Extend the plugin without leaving OpenCode:
|
|
212
212
|
|
|
213
|
-
- **`/new-agent`** -- Create a custom agent with YAML frontmatter + system prompt
|
|
214
|
-
- **`/new-skill`** -- Create a skill directory with domain knowledge
|
|
215
|
-
- **`/new-command`** -- Create a slash command (validates against built-in names)
|
|
213
|
+
- **`/oc-new-agent`** -- Create a custom agent with YAML frontmatter + system prompt
|
|
214
|
+
- **`/oc-new-skill`** -- Create a skill directory with domain knowledge
|
|
215
|
+
- **`/oc-new-command`** -- Create a slash command (validates against built-in names)
|
|
216
216
|
|
|
217
217
|
All created assets write to `~/.config/opencode/` and are available immediately.
|
|
218
218
|
|
|
219
219
|
## Configuration
|
|
220
220
|
|
|
221
|
-
Config lives at `~/.config/opencode/opencode-autopilot.json`. Run
|
|
221
|
+
Config lives at `~/.config/opencode/opencode-autopilot.json`. Run `bunx @kodrunhq/opencode-autopilot configure` for interactive setup, or edit manually.
|
|
222
222
|
|
|
223
223
|
| Setting | Options | Default |
|
|
224
224
|
|---------|---------|---------|
|
package/bin/cli.ts
CHANGED
|
@@ -200,7 +200,7 @@ async function printSystemChecks(
|
|
|
200
200
|
console.log(` Setup completed ${green("✓")} configured: true`);
|
|
201
201
|
} else {
|
|
202
202
|
console.log(
|
|
203
|
-
` Setup completed ${red("✗")} configured: false — run /
|
|
203
|
+
` Setup completed ${red("✗")} configured: false — run bunx @kodrunhq/opencode-autopilot configure`,
|
|
204
204
|
);
|
|
205
205
|
hasFailure = true;
|
|
206
206
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodrunhq/opencode-autopilot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Curated agents, skills, and commands for the OpenCode AI coding CLI — autonomous orchestrator, multi-agent code review, model fallback, and in-session asset creation tools.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"keywords": [
|
package/src/index.ts
CHANGED
|
@@ -236,7 +236,7 @@ const plugin: Plugin = async (input) => {
|
|
|
236
236
|
if (event.type === "session.created" && isFirstLoad(config)) {
|
|
237
237
|
await sdkOps.showToast(
|
|
238
238
|
"Welcome to OpenCode Autopilot!",
|
|
239
|
-
"Run
|
|
239
|
+
"Plugin loaded. Run oc_doctor to verify your setup.",
|
|
240
240
|
"info",
|
|
241
241
|
);
|
|
242
242
|
}
|
package/src/installer.ts
CHANGED
|
@@ -7,14 +7,28 @@ import { getAssetsDir, getGlobalConfigDir } from "./utils/paths";
|
|
|
7
7
|
* Assets that were previously shipped but have since been removed from the source repo.
|
|
8
8
|
* These are cleaned up from the target directory on every install to avoid stale files.
|
|
9
9
|
*/
|
|
10
|
-
const DEPRECATED_ASSETS = [
|
|
10
|
+
const DEPRECATED_ASSETS = [
|
|
11
|
+
"agents/placeholder-agent.md",
|
|
12
|
+
"commands/configure.md",
|
|
13
|
+
"commands/oc-configure.md",
|
|
14
|
+
"commands/brainstorm.md",
|
|
15
|
+
"commands/new-agent.md",
|
|
16
|
+
"commands/new-command.md",
|
|
17
|
+
"commands/new-skill.md",
|
|
18
|
+
"commands/quick.md",
|
|
19
|
+
"commands/review-pr.md",
|
|
20
|
+
"commands/stocktake.md",
|
|
21
|
+
"commands/tdd.md",
|
|
22
|
+
"commands/update-docs.md",
|
|
23
|
+
"commands/write-plan.md",
|
|
24
|
+
] as const;
|
|
11
25
|
|
|
12
26
|
/**
|
|
13
27
|
* Assets that must be overwritten on every install, even if the user has a copy.
|
|
14
28
|
* Used when the shipped version has critical fixes that override user customizations.
|
|
15
29
|
* Remove entries once the fix has been deployed long enough.
|
|
16
30
|
*/
|
|
17
|
-
const FORCE_UPDATE_ASSETS = [
|
|
31
|
+
const FORCE_UPDATE_ASSETS = [] as const;
|
|
18
32
|
|
|
19
33
|
export interface InstallResult {
|
|
20
34
|
readonly copied: readonly string[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import { getObservationsByProject, getProjectByPath } from "../memory/repository";
|
|
1
3
|
import { summarizeConfidence } from "./confidence";
|
|
2
4
|
import type { ConfidenceEntry } from "./types";
|
|
3
5
|
|
|
@@ -39,3 +41,32 @@ export function shouldTriggerExplorer(
|
|
|
39
41
|
const thresholdOrder = LEVEL_ORDER[threshold];
|
|
40
42
|
return entries.some((entry) => LEVEL_ORDER[entry.level] < thresholdOrder);
|
|
41
43
|
}
|
|
44
|
+
|
|
45
|
+
/** Minimum error observations to trigger deeper review. */
|
|
46
|
+
const ERROR_DEPTH_THRESHOLD = 3;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Memory-tuned debate depth: adjusts arena depth based on project error history.
|
|
50
|
+
* Scans the 50 most-recent observations (recency window) — older errors are not counted.
|
|
51
|
+
* Projects with 3+ error observations in the window get deeper review (+1, capped at 3).
|
|
52
|
+
* Best-effort: memory errors never affect pipeline (falls back to standard depth).
|
|
53
|
+
*/
|
|
54
|
+
export function getMemoryTunedDepth(
|
|
55
|
+
entries: readonly ConfidenceEntry[],
|
|
56
|
+
projectPath: string,
|
|
57
|
+
db?: Database,
|
|
58
|
+
): number {
|
|
59
|
+
const baseDepth = getDebateDepth(entries);
|
|
60
|
+
try {
|
|
61
|
+
const project = getProjectByPath(projectPath, db);
|
|
62
|
+
if (!project) return baseDepth;
|
|
63
|
+
const observations = getObservationsByProject(project.id, 50, db);
|
|
64
|
+
const errorCount = observations.filter((o) => o.type === "error").length;
|
|
65
|
+
if (errorCount >= ERROR_DEPTH_THRESHOLD) {
|
|
66
|
+
return Math.min(baseDepth + 1, 3);
|
|
67
|
+
}
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.warn("[opencode-autopilot] memory-tuned depth failed, using base:", err);
|
|
70
|
+
}
|
|
71
|
+
return baseDepth;
|
|
72
|
+
}
|
|
@@ -2,7 +2,7 @@ import { readdir } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { sanitizeTemplateContent } from "../../review/sanitize";
|
|
4
4
|
import { fileExists } from "../../utils/fs-helpers";
|
|
5
|
-
import {
|
|
5
|
+
import { getMemoryTunedDepth } from "../arena";
|
|
6
6
|
import { ensurePhaseDir, getArtifactRef, getPhaseDir } from "../artifacts";
|
|
7
7
|
import { filterByPhase } from "../confidence";
|
|
8
8
|
import type { PipelineState } from "../types";
|
|
@@ -62,7 +62,7 @@ export async function handleArchitect(
|
|
|
62
62
|
// Step 1: Dispatch architect(s) based on confidence depth
|
|
63
63
|
await ensurePhaseDir(artifactDir, "ARCHITECT");
|
|
64
64
|
const reconEntries = filterByPhase(state.confidence, "RECON");
|
|
65
|
-
const depth =
|
|
65
|
+
const depth = getMemoryTunedDepth(reconEntries, join(artifactDir, ".."));
|
|
66
66
|
const reconRef = getArtifactRef("RECON", "report.md");
|
|
67
67
|
const challengeRef = getArtifactRef("CHALLENGE", "brief.md");
|
|
68
68
|
const safeIdea = sanitizeTemplateContent(state.idea).replace(/[\r\n]+/g, " ");
|
|
@@ -82,9 +82,9 @@ export async function loadAdaptiveSkillContext(
|
|
|
82
82
|
|
|
83
83
|
const matchingSkills = filterSkillsByStack(allSkills, projectTags);
|
|
84
84
|
return buildMultiSkillContext(matchingSkills, tokenBudget);
|
|
85
|
-
} catch
|
|
86
|
-
// Best-effort
|
|
87
|
-
|
|
85
|
+
} catch {
|
|
86
|
+
// Best-effort: all errors return empty string. Caller (injectSkillContext)
|
|
87
|
+
// logs the error — no need to re-throw since the call site is also best-effort.
|
|
88
88
|
return "";
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/tools/doctor.ts
CHANGED
|
@@ -28,7 +28,7 @@ interface DoctorOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
const FIX_SUGGESTIONS: Readonly<Record<string, string>> = Object.freeze({
|
|
30
30
|
"config-validity":
|
|
31
|
-
"Run /
|
|
31
|
+
"Run `bunx @kodrunhq/opencode-autopilot configure` to reconfigure, or delete ~/.config/opencode/opencode-autopilot.json to reset",
|
|
32
32
|
"agent-injection": "Restart OpenCode to trigger agent re-injection via config hook",
|
|
33
33
|
"asset-directories": "Restart OpenCode to trigger asset reinstallation",
|
|
34
34
|
});
|
package/src/tools/orchestrate.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { DispatchResult } from "../orchestrator/handlers/types";
|
|
|
5
5
|
import { buildLessonContext } from "../orchestrator/lesson-injection";
|
|
6
6
|
import { loadLessonMemory } from "../orchestrator/lesson-memory";
|
|
7
7
|
import { completePhase, getNextPhase } from "../orchestrator/phase";
|
|
8
|
-
import {
|
|
8
|
+
import { loadAdaptiveSkillContext } from "../orchestrator/skill-injection";
|
|
9
9
|
import { createInitialState, loadState, patchState, saveState } from "../orchestrator/state";
|
|
10
10
|
import type { Phase } from "../orchestrator/types";
|
|
11
11
|
import { isEnoentError } from "../utils/fs-helpers";
|
|
@@ -96,17 +96,16 @@ async function injectLessonContext(
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Attempt to inject
|
|
99
|
+
* Attempt to inject stack-filtered adaptive skill context into a dispatch prompt.
|
|
100
100
|
* Best-effort: failures are silently swallowed to avoid breaking dispatch.
|
|
101
101
|
*/
|
|
102
|
-
async function injectSkillContext(prompt: string): Promise<string> {
|
|
102
|
+
async function injectSkillContext(prompt: string, projectRoot?: string): Promise<string> {
|
|
103
103
|
try {
|
|
104
104
|
const baseDir = getGlobalConfigDir();
|
|
105
|
-
const
|
|
106
|
-
const ctx = buildSkillContext(content);
|
|
105
|
+
const ctx = await loadAdaptiveSkillContext(baseDir, projectRoot ?? process.cwd());
|
|
107
106
|
if (ctx) return prompt + ctx;
|
|
108
|
-
} catch {
|
|
109
|
-
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.warn("[opencode-autopilot] skill injection failed:", err);
|
|
110
109
|
}
|
|
111
110
|
return prompt;
|
|
112
111
|
}
|
|
@@ -146,7 +145,7 @@ async function processHandlerResult(
|
|
|
146
145
|
handlerResult.phase,
|
|
147
146
|
artifactDir,
|
|
148
147
|
);
|
|
149
|
-
const withSkills = await injectSkillContext(enrichedPrompt);
|
|
148
|
+
const withSkills = await injectSkillContext(enrichedPrompt, join(artifactDir, ".."));
|
|
150
149
|
if (withSkills !== handlerResult.prompt) {
|
|
151
150
|
return JSON.stringify({ ...handlerResult, prompt: withSkills });
|
|
152
151
|
}
|
|
@@ -163,7 +162,7 @@ async function processHandlerResult(
|
|
|
163
162
|
handlerResult.phase as string,
|
|
164
163
|
artifactDir,
|
|
165
164
|
);
|
|
166
|
-
const skillSuffix = await injectSkillContext("");
|
|
165
|
+
const skillSuffix = await injectSkillContext("", join(artifactDir, ".."));
|
|
167
166
|
const combinedSuffix = lessonSuffix + (skillSuffix || "");
|
|
168
167
|
if (combinedSuffix) {
|
|
169
168
|
const enrichedAgents = handlerResult.agents.map((entry) => ({
|
package/src/tools/quick.ts
CHANGED
|
@@ -21,7 +21,7 @@ interface QuickArgs {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Core logic for the /quick command.
|
|
24
|
+
* Core logic for the /oc-quick command.
|
|
25
25
|
* Creates a pipeline state that starts at PLAN (skipping discovery phases),
|
|
26
26
|
* then delegates to orchestrateCore to continue the pipeline.
|
|
27
27
|
*/
|
|
@@ -30,7 +30,7 @@ export async function quickCore(args: QuickArgs, artifactDir: string): Promise<s
|
|
|
30
30
|
if (!args.idea || args.idea.trim().length === 0) {
|
|
31
31
|
return JSON.stringify({
|
|
32
32
|
action: "error",
|
|
33
|
-
message: "No idea provided. Usage: /quick <describe the task>",
|
|
33
|
+
message: "No idea provided. Usage: /oc-quick <describe the task>",
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -64,7 +64,7 @@ export async function quickCore(args: QuickArgs, artifactDir: string): Promise<s
|
|
|
64
64
|
phase: "PLAN",
|
|
65
65
|
agent: "oc-quick",
|
|
66
66
|
decision: "Skip discovery phases",
|
|
67
|
-
rationale: "Quick task mode: user explicitly requested simplified pipeline via /quick",
|
|
67
|
+
rationale: "Quick task mode: user explicitly requested simplified pipeline via /oc-quick",
|
|
68
68
|
},
|
|
69
69
|
],
|
|
70
70
|
confidence: [],
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Configure opencode-autopilot model assignments for each agent group
|
|
3
|
-
agent: autopilot
|
|
4
|
-
---
|
|
5
|
-
Model configuration uses an interactive terminal wizard with searchable
|
|
6
|
-
model selection. This cannot be done inside the OpenCode TUI — it requires
|
|
7
|
-
a separate terminal.
|
|
8
|
-
|
|
9
|
-
Tell the user to open a terminal and run:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
bunx @kodrunhq/opencode-autopilot configure
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
This will:
|
|
16
|
-
1. Discover all available models from their configured providers
|
|
17
|
-
2. Walk through each of the 8 agent groups with a searchable model picker
|
|
18
|
-
3. For each group, select a primary model and optional fallback models
|
|
19
|
-
4. Check adversarial diversity (different families for groups that review each other)
|
|
20
|
-
5. Save the configuration
|
|
21
|
-
|
|
22
|
-
After running the wizard, tell the user to restart OpenCode to pick up
|
|
23
|
-
the new model assignments.
|
|
24
|
-
|
|
25
|
-
Do NOT attempt to configure models through the oc_configure tool's assign
|
|
26
|
-
subcommand directly. The interactive wizard is the supported configuration
|
|
27
|
-
method.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|