opencodekit 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/index.js +53 -18
  2. package/dist/template/.opencode/.background-tasks.json +96 -0
  3. package/dist/template/.opencode/.ralph-state.json +12 -0
  4. package/dist/template/.opencode/AGENTS.md +112 -6
  5. package/dist/template/.opencode/agent/build.md +60 -8
  6. package/dist/template/.opencode/agent/explore.md +1 -0
  7. package/dist/template/.opencode/agent/looker.md +124 -0
  8. package/dist/template/.opencode/agent/planner.md +40 -1
  9. package/dist/template/.opencode/agent/review.md +1 -0
  10. package/dist/template/.opencode/agent/rush.md +53 -6
  11. package/dist/template/.opencode/agent/scout.md +1 -1
  12. package/dist/template/.opencode/agent/vision.md +0 -1
  13. package/dist/template/.opencode/command/brainstorm.md +58 -3
  14. package/dist/template/.opencode/command/finish.md +18 -8
  15. package/dist/template/.opencode/command/fix.md +24 -15
  16. package/dist/template/.opencode/command/implement.md +95 -29
  17. package/dist/template/.opencode/command/import-plan.md +30 -8
  18. package/dist/template/.opencode/command/new-feature.md +105 -14
  19. package/dist/template/.opencode/command/plan.md +78 -11
  20. package/dist/template/.opencode/command/pr.md +25 -15
  21. package/dist/template/.opencode/command/ralph-loop.md +97 -0
  22. package/dist/template/.opencode/command/revert-feature.md +15 -3
  23. package/dist/template/.opencode/command/skill-optimize.md +71 -7
  24. package/dist/template/.opencode/command/start.md +63 -15
  25. package/dist/template/.opencode/dcp.jsonc +11 -7
  26. package/dist/template/.opencode/memory/{project/beads-workflow.md → beads-workflow.md} +53 -0
  27. package/dist/template/.opencode/memory/observations/2026-01-09-pattern-ampcode-mcp-json-includetools-pattern.md +42 -0
  28. package/dist/template/.opencode/memory/project/conventions.md +53 -3
  29. package/dist/template/.opencode/memory/project/gotchas.md +52 -5
  30. package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/{0-8d00d272-cb80-463b-9774-7120a1c994e7.txn → 0-0d25ba80-ba3b-4209-9046-b45d6093b4da.txn} +0 -0
  31. package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/1.manifest +0 -0
  32. package/dist/template/.opencode/memory/vector_db/memories.lance/data/{001010101000000101110001f998d04b63936ff83f9a34152d.lance → 1111100101010101011010004a9ef34df6b29f36a9a53a2892.lance} +0 -0
  33. package/dist/template/.opencode/opencode.json +529 -587
  34. package/dist/template/.opencode/package.json +2 -1
  35. package/dist/template/.opencode/plugin/lsp.ts +299 -0
  36. package/dist/template/.opencode/plugin/memory.ts +77 -1
  37. package/dist/template/.opencode/plugin/package.json +1 -1
  38. package/dist/template/.opencode/plugin/ralph-wiggum.ts +182 -0
  39. package/dist/template/.opencode/plugin/skill-mcp.ts +155 -36
  40. package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +43 -65
  41. package/dist/template/.opencode/skill/chrome-devtools/mcp.json +19 -0
  42. package/dist/template/.opencode/skill/executing-plans/SKILL.md +32 -2
  43. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +42 -17
  44. package/dist/template/.opencode/skill/playwright/SKILL.md +58 -133
  45. package/dist/template/.opencode/skill/playwright/mcp.json +16 -0
  46. package/dist/template/.opencode/tool/background.ts +461 -0
  47. package/dist/template/.opencode/tool/memory-search.ts +2 -2
  48. package/dist/template/.opencode/tool/ralph.ts +203 -0
  49. package/package.json +4 -16
  50. package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/1-a3bea825-dad3-47dd-a6d6-ff41b76ff7b0.txn +0 -0
  51. package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/2.manifest +0 -0
  52. package/dist/template/.opencode/memory/vector_db/memories.lance/data/010000101010000000010010701b3840d38c2b5f275da99978.lance +0 -0
  53. /package/dist/template/.opencode/memory/{project/README.md → README.md} +0 -0
  54. /package/dist/template/.opencode/plugin/{notification.ts → notification.ts.bak} +0 -0
package/dist/index.js CHANGED
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
750
750
  // package.json
751
751
  var package_default = {
752
752
  name: "opencodekit",
753
- version: "0.14.0",
753
+ version: "0.14.2",
754
754
  description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
755
755
  type: "module",
756
756
  repository: {
@@ -764,10 +764,7 @@ var package_default = {
764
764
  bin: {
765
765
  ock: "dist/index.js"
766
766
  },
767
- files: [
768
- "dist",
769
- "README.md"
770
- ],
767
+ files: ["dist", "README.md"],
771
768
  scripts: {
772
769
  dev: "bun run src/index.ts",
773
770
  build: "bun run build.ts && mkdir -p dist/template && rsync -av --exclude=node_modules --exclude=dist --exclude=.git --exclude=coverage --exclude=.next --exclude=.turbo --exclude=logs --exclude=package-lock.json .opencode/ dist/template/.opencode/",
@@ -779,14 +776,7 @@ var package_default = {
779
776
  lint: "biome check .",
780
777
  "lint:fix": "biome check --fix ."
781
778
  },
782
- keywords: [
783
- "cli",
784
- "opencodekit",
785
- "template",
786
- "agents",
787
- "mcp",
788
- "opencode"
789
- ],
779
+ keywords: ["cli", "opencodekit", "template", "agents", "mcp", "opencode"],
790
780
  author: "OpenCodeKit",
791
781
  license: "MIT",
792
782
  engines: {
@@ -812,9 +802,7 @@ var package_default = {
812
802
  "@types/node": "^22.10.1",
813
803
  typescript: "^5.7.2"
814
804
  },
815
- trustedDependencies: [
816
- "@beads/bd"
817
- ]
805
+ trustedDependencies: ["@beads/bd"]
818
806
  };
819
807
 
820
808
  // src/commands/agent.ts
@@ -3777,6 +3765,7 @@ import {
3777
3765
  readdirSync as readdirSync3,
3778
3766
  writeFileSync as writeFileSync4
3779
3767
  } from "node:fs";
3768
+ import { homedir, platform } from "node:os";
3780
3769
  import { basename as basename2, dirname, join as join4 } from "node:path";
3781
3770
  import { fileURLToPath } from "node:url";
3782
3771
  var import_picocolors8 = __toESM(require_picocolors(), 1);
@@ -3795,6 +3784,15 @@ var EXCLUDED_FILES = [
3795
3784
  "yarn.lock",
3796
3785
  "pnpm-lock.yaml"
3797
3786
  ];
3787
+ function getGlobalConfigDir() {
3788
+ const os = platform();
3789
+ if (os === "win32") {
3790
+ const appData = process.env.APPDATA || process.env.LOCALAPPDATA || join4(homedir(), "AppData", "Roaming");
3791
+ return join4(appData, "opencode");
3792
+ }
3793
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir(), ".config");
3794
+ return join4(xdgConfig, "opencode");
3795
+ }
3798
3796
  function detectMode(targetDir) {
3799
3797
  const opencodeDir = join4(targetDir, ".opencode");
3800
3798
  if (existsSync4(opencodeDir)) {
@@ -3854,9 +3852,46 @@ async function copyOpenCodeOnly(templateRoot, targetDir) {
3854
3852
  async function initCommand(options = {}) {
3855
3853
  if (process.argv.includes("--quiet"))
3856
3854
  return;
3855
+ oe(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" OpenCodeKit ")));
3856
+ if (options.global) {
3857
+ const globalDir = getGlobalConfigDir();
3858
+ const os = platform();
3859
+ const osName = os === "win32" ? "Windows" : os === "darwin" ? "macOS" : "Linux";
3860
+ f2.info(`Installing to global config (${osName})`);
3861
+ f2.info(`Target: ${import_picocolors8.default.cyan(globalDir)}`);
3862
+ const templateRoot2 = getTemplateRoot();
3863
+ if (!templateRoot2) {
3864
+ f2.error("Template not found. Please reinstall opencodekit.");
3865
+ $e(import_picocolors8.default.red("Failed"));
3866
+ process.exit(1);
3867
+ }
3868
+ if (existsSync4(globalDir) && !options.force) {
3869
+ f2.warn(`Global config already exists at ${globalDir}`);
3870
+ f2.info(`Use ${import_picocolors8.default.cyan("--force")} to overwrite`);
3871
+ $e("Nothing to do");
3872
+ return;
3873
+ }
3874
+ const s2 = de();
3875
+ s2.start("Copying to global config");
3876
+ const opencodeSrc = join4(templateRoot2, ".opencode");
3877
+ if (!existsSync4(opencodeSrc)) {
3878
+ s2.stop("Failed");
3879
+ f2.error("Template .opencode/ not found");
3880
+ $e(import_picocolors8.default.red("Failed"));
3881
+ process.exit(1);
3882
+ }
3883
+ await copyDir(opencodeSrc, globalDir);
3884
+ s2.stop("Done");
3885
+ le(`Global config installed at:
3886
+ ${globalDir}
3887
+
3888
+ This provides default agents, skills, and tools
3889
+ for all OpenCode projects on this machine.`, "Global Installation Complete");
3890
+ $e(import_picocolors8.default.green("Ready!"));
3891
+ return;
3892
+ }
3857
3893
  const targetDir = process.cwd();
3858
3894
  const mode = detectMode(targetDir);
3859
- oe(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" OpenCodeKit ")));
3860
3895
  if (mode === "already-initialized" && !options.force) {
3861
3896
  f2.warn("Already initialized (.opencode/ exists)");
3862
3897
  f2.info(`Use ${import_picocolors8.default.cyan("--force")} to reinitialize`);
@@ -6010,7 +6045,7 @@ var cli = cac("ock");
6010
6045
  cli.option("--verbose", "Enable verbose logging");
6011
6046
  cli.option("--quiet", "Suppress all output");
6012
6047
  cli.version(`${packageVersion}`);
6013
- cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").action(initCommand);
6048
+ cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").option("--global", "Install to global OpenCode config (~/.config/opencode/)").action(initCommand);
6014
6049
  cli.command("agent [action]", "Manage agents (list, add, view)").action(async (action) => {
6015
6050
  if (!action) {
6016
6051
  console.log(`
@@ -0,0 +1,96 @@
1
+ {
2
+ "tasks": {
3
+ "bg_1767973877335_d2ihzd": {
4
+ "taskId": "bg_1767973877335_d2ihzd",
5
+ "sessionId": "ses_45c8b89a4ffeuq5BxBRQv4wrwd",
6
+ "agent": "explore",
7
+ "prompt": "Find all agent definitions in this project. List the file paths and agent names.",
8
+ "started": 1767973890766,
9
+ "status": "cancelled"
10
+ },
11
+ "bg_1767973898236_s7kyjm": {
12
+ "taskId": "bg_1767973898236_s7kyjm",
13
+ "sessionId": "ses_45c8b37ffffeIMMtZrHruaRN7A",
14
+ "agent": "scout",
15
+ "prompt": "What is the latest version of @opencode-ai/sdk and what are its main features?",
16
+ "started": 1767973936815,
17
+ "status": "completed"
18
+ },
19
+ "bg_1767974743680_ppd6p1": {
20
+ "taskId": "bg_1767974743680_ppd6p1",
21
+ "sessionId": "ses_45c7e517bffeagStJem1UDrHNf",
22
+ "agent": "explore",
23
+ "prompt": "Find all TypeScript files in the .opencode/tool directory and list them.",
24
+ "started": 1767974756797,
25
+ "status": "completed",
26
+ "beadId": "opencodekit-template-ag8",
27
+ "autoCloseBead": true
28
+ },
29
+ "bg_1767974825480_mlpk5z": {
30
+ "taskId": "bg_1767974825480_mlpk5z",
31
+ "sessionId": "ses_45c7d11efffe9LnnUp1W2C7GiI",
32
+ "agent": "explore",
33
+ "prompt": "List all files in .opencode/agent directory",
34
+ "started": 1767974843970,
35
+ "status": "completed",
36
+ "beadId": "opencodekit-template-3k0",
37
+ "autoCloseBead": true
38
+ },
39
+ "bg_1767975003390_y1pliv": {
40
+ "taskId": "bg_1767975003390_y1pliv",
41
+ "sessionId": "ses_45c7a5afffferx20SjJEy782Ap",
42
+ "agent": "explore",
43
+ "prompt": "Count the number of markdown files in .opencode/command directory",
44
+ "started": 1767975020306,
45
+ "status": "completed",
46
+ "beadId": "opencodekit-template-0ch",
47
+ "autoCloseBead": true
48
+ },
49
+ "bg_1767975064912_8nvlh7": {
50
+ "taskId": "bg_1767975064912_8nvlh7",
51
+ "sessionId": "ses_45c796aa9ffeYEhEzxybXEuOfO",
52
+ "agent": "explore",
53
+ "prompt": "List files in .opencode/agent directory",
54
+ "started": 1767975078449,
55
+ "status": "completed",
56
+ "beadId": "opencodekit-template-ryg",
57
+ "autoCloseBead": true
58
+ },
59
+ "bg_1767982850780_sdkoc4": {
60
+ "taskId": "bg_1767982850780_sdkoc4",
61
+ "sessionId": "ses_45c029d22ffe7cWSSebxdvxIgL",
62
+ "agent": "explore",
63
+ "prompt": "Find all TypeScript files in the src/commands directory and list what each command does. This is a test of agent delegation.",
64
+ "started": 1767982870771,
65
+ "status": "completed"
66
+ },
67
+ "bg_1767984165033_jyv9bd": {
68
+ "taskId": "bg_1767984165033_jyv9bd",
69
+ "sessionId": "ses_45bee8f51ffeJ6B5L7AMik624S",
70
+ "parentSessionId": "ses_45c0ae526ffeQlmBlscyZMZALt",
71
+ "agent": "explore",
72
+ "prompt": "List all TypeScript files in .opencode/tool/ directory and briefly describe what each tool does. This is a test of sub-session linking.",
73
+ "started": 1767984193526,
74
+ "status": "completed"
75
+ },
76
+ "bg_1767984696916_qi0xa9": {
77
+ "taskId": "bg_1767984696916_qi0xa9",
78
+ "sessionId": "ses_45be671a7ffeXRL43PHImPBtCh",
79
+ "parentSessionId": "ses_45c0ae526ffeQlmBlscyZMZALt",
80
+ "agent": "explore",
81
+ "prompt": "Find all files in src/commands/ and list their exports. This is a test of the updated background tool.",
82
+ "started": 1767984719380,
83
+ "status": "completed",
84
+ "beadId": "bd-test-123"
85
+ },
86
+ "bg_1767985457040_uo3le4": {
87
+ "taskId": "bg_1767985457040_uo3le4",
88
+ "sessionId": "ses_45bdad86bffeZNUcXDi1wrSwxb",
89
+ "parentSessionId": "ses_45c0ae526ffeQlmBlscyZMZALt",
90
+ "agent": "explore",
91
+ "prompt": "List files in src/ directory. Quick test.",
92
+ "started": 1767985471066,
93
+ "status": "running"
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "active": false,
3
+ "sessionID": null,
4
+ "iteration": 0,
5
+ "maxIterations": 50,
6
+ "completionPromise": "<promise>COMPLETE</promise>",
7
+ "task": "",
8
+ "prdFile": null,
9
+ "progressFile": "progress.txt",
10
+ "startedAt": null,
11
+ "mode": "hitl"
12
+ }
@@ -17,9 +17,59 @@ Everything else is guidelines, not laws.
17
17
  - **Search/Docs** → @explore / @scout
18
18
  - **Review/Debug** → @review
19
19
  - **Plan/Design** → @planner / @vision
20
+ - **Media Extraction** → @looker (images, PDFs, diagrams needing OCR/parsing)
20
21
 
21
22
  If yes → Delegate. If no → Execute directly.
22
23
 
24
+ ### @vision vs @looker
25
+
26
+ When you encounter media files (images, PDFs, diagrams), ask: **"Do I need extraction or judgment?"**
27
+
28
+ **@looker** handles pure extraction—getting content OUT of media. Use it when you need to read what's inside: OCR text from images, parse PDF documents, describe diagram components, extract table data, or transcribe handwritten notes. Looker is cheap (Gemini Flash), fast, and read-only. It tells you WHAT is there.
29
+
30
+ **@vision** handles design judgment—evaluating HOW something looks. Use it when you need critique: accessibility audits, UI/UX reviews, design system consistency checks, mockup feedback, or anti-slop detection. Vision is expensive (Gemini Pro), thorough, and opinionated. It tells you if something is GOOD.
31
+
32
+ ## Question Tool
33
+
34
+ **Rule**: Use `question` tool to gather user input when interpretation matters.
35
+
36
+ ### When to Use
37
+
38
+ Use the question tool when ambiguous requests could lead to significantly different implementations—if "add auth" could mean OAuth, JWT, or session-based, ask before building the wrong thing. Use it when multiple valid approaches exist and user preference matters, like choosing between frameworks or patterns. Always ask before destructive operations like deleting branches, resetting hard, or force pushing. When user preferences affect the outcome—naming conventions, file structure, coding style—let them choose. For gathering multiple selections at once, use `multiple: true` to let users pick several options.
39
+
40
+ ### When NOT to Use
41
+
42
+ Skip the question tool for trivial decisions where any reasonable choice works. If you already have enough context from the conversation, just proceed. When you can make a sensible default, mention what you're doing and continue—don't stop for permission on every small choice. Subagents like explore, scout, and review should never ask questions; they report findings back to the leader agent who decides what to do.
43
+
44
+ ### Question Design
45
+
46
+ ```typescript
47
+ question({
48
+ questions: [
49
+ {
50
+ header: "Auth Type", // Max 12 chars
51
+ question: "Which authentication approach?",
52
+ multiple: false, // true for multi-select
53
+ options: [
54
+ { label: "JWT (Recommended)", description: "Stateless, scalable" },
55
+ { label: "Session-based", description: "Traditional, server-side" },
56
+ { label: "OAuth 2.0", description: "Third-party providers" },
57
+ ],
58
+ },
59
+ ],
60
+ });
61
+ ```
62
+
63
+ **Design Rules:**
64
+
65
+ 1. **Analyze before recommending**: Evaluate each option against the user's context, project constraints, and industry best practices. Only add "(Recommended)" to the option that genuinely fits best—don't default to the first option blindly.
66
+
67
+ 2. **Put recommended first**: Place the analyzed best-practice option first with "(Recommended)" in the label so users can quickly identify the optimal choice.
68
+
69
+ 3. **Keep it focused**: Limit to 3-5 options—more overwhelms users. Write short, clear descriptions that explain the tradeoff of each option.
70
+
71
+ 4. **Don't over-specify**: Users can always select "Other" to provide custom input, so you don't need to cover every edge case.
72
+
23
73
  ## Anti-Hallucination (The Truth)
24
74
 
25
75
  - **Check First**: Run `bd show <id>` before starting major work.
@@ -37,14 +87,31 @@ If yes → Delegate. If no → Execute directly.
37
87
 
38
88
  ## Tool Priority
39
89
 
40
- **Rule**: Always `read` before `edit`.
41
-
42
- 1. **LSP (Best)**: `lsp_lsp_document_symbols`, `lsp_lsp_goto_definition`. **Follow [LSP NAVIGATION AVAILABLE] nudges immediately.**
90
+ **Rule**: Always `read` before `edit`. Always `LSP` before `edit`.
91
+
92
+ 1. **LSP (Best)**: Use ALL 9 operations. **MANDATORY before ANY edit.**
93
+ - `documentSymbol` - File structure (functions, classes, variables)
94
+ - `goToDefinition` - Jump to where symbol is defined
95
+ - `findReferences` - Find all usages of a symbol
96
+ - `hover` - Get type info and documentation
97
+ - `goToImplementation` - Find implementations of interface/abstract
98
+ - `workspaceSymbol` - Search symbols across entire workspace
99
+ - `prepareCallHierarchy` - Get call hierarchy item at position
100
+ - `incomingCalls` - Find what calls this function
101
+ - `outgoingCalls` - Find what this function calls
43
102
  2. **Memory**: `memory-search` (Check past learnings), `repo-map` (Understand structure).
44
103
  3. **Structure**: `ast-grep` (Find functions/classes patterns)
45
104
  4. **Search**: `grep` (Find text/TODOs)
46
105
  5. **Files**: `glob` (Find files)
47
106
 
107
+ **LSP-First Workflow (HARD RULE):**
108
+
109
+ ```
110
+ grep/read → LSP → understand → THEN edit
111
+ ```
112
+
113
+ Violations: `read → edit` or `grep → edit` without LSP = WRONG.
114
+
48
115
  ## Active Memory (The Brain)
49
116
 
50
117
  **Rule**: Use memory proactively, not just when asked.
@@ -57,9 +124,48 @@ If yes → Delegate. If no → Execute directly.
57
124
 
58
125
  **Leader Only**: `build` and `rush` agents own the DB. Subagents read-only.
59
126
 
60
- - **Start**: `bd_init()` → `bd_claim()`
61
- - **Work**: `bd_reserve()` (Lock files!) → Edit
62
- - **Finish**: `bd_done()` → **RESTART SESSION**
127
+ - **Start**: `bd ready` → `bd update <id> --status in_progress`
128
+ - **Work**: `bd-reserve({ paths: [...] })` (Lock files!) → Edit
129
+ - **Finish**: `bd close <id> --reason "..."` → `bd sync` → **RESTART SESSION**
130
+
131
+ ## Parallel Execution
132
+
133
+ **Rule**: Fire research subagents in background, continue working, collect when needed.
134
+
135
+ For complex tasks with multiple unknowns, don't wait for sequential research. Launch parallel background tasks:
136
+
137
+ **Allowed agents for background delegation:**
138
+
139
+ - **Subagents**: explore, scout, review, planner, vision, looker (stateless workers)
140
+ - **Primary**: rush (autonomous execution)
141
+ - **NOT allowed**: build (build is the orchestrator that uses this tool)
142
+
143
+ ```typescript
144
+ // Fire parallel research (non-blocking)
145
+ background_start({ agent: "explore", prompt: "Find auth patterns..." }); // → bg_123_abc
146
+ background_start({ agent: "scout", prompt: "Find JWT docs..." }); // → bg_456_def
147
+
148
+ // Continue with implementation work immediately...
149
+
150
+ // Collect results when needed
151
+ background_output({ taskId: "bg_123_abc" });
152
+ background_output({ taskId: "bg_456_def" });
153
+
154
+ // Cleanup at session end
155
+ background_cancel({ all: true });
156
+ ```
157
+
158
+ **When to use background execution:**
159
+
160
+ - Multiple independent research questions
161
+ - Complex tasks touching unfamiliar code
162
+ - Need both codebase patterns AND external docs
163
+
164
+ **When NOT to use:**
165
+
166
+ - Simple, well-understood changes
167
+ - Sequential dependencies (B needs A's output)
168
+ - Quick fixes with known approach
63
169
 
64
170
  ## Core Constraints
65
171
 
@@ -62,7 +62,50 @@ Before ANY action on a new request, do two things.
62
62
 
63
63
  **First, check skills.** If the request matches a skill trigger phrase, invoke that skill immediately. Skills are specialized workflows that handle specific tasks better than manual orchestration. Don't proceed until you've checked.
64
64
 
65
- **Second, classify the request.** Trivial requests (single file, known location) get direct tool use. Explicit requests (specific file and line, clear command) get immediate execution. Exploratory requests ("how does X work?") get delegated to @explore. Open-ended requests ("improve this", "add a feature") require codebase assessment first. Ambiguous requests where interpretations differ by 2x or more in effort require clarification—ask ONE question.
65
+ **Second, classify the request.** Trivial requests (single file, known location) get direct tool use. Explicit requests (specific file and line, clear command) get immediate execution. Exploratory requests ("how does X work?") get delegated to @explore. Open-ended requests ("improve this", "add a feature") require codebase assessment first. Ambiguous requests where interpretations differ by 2x or more in effort require clarification—use the `question` tool to ask ONE focused question.
66
+
67
+ ## Using the Question Tool
68
+
69
+ Use `question` when user intent is unclear and wrong interpretation wastes significant effort.
70
+
71
+ **Good triggers:**
72
+
73
+ - "Add auth" → Ask: OAuth vs JWT vs session-based?
74
+ - "Refactor this" → Ask: Performance? Readability? Testability?
75
+ - "Build a dashboard" → Ask: Which metrics? What layout?
76
+
77
+ **Bad triggers (just proceed):**
78
+
79
+ - "Fix this typo" → Just fix it
80
+ - "Run tests" → Just run them
81
+ - User already specified details → Don't re-ask
82
+
83
+ **Question design:**
84
+
85
+ ```typescript
86
+ question({
87
+ questions: [
88
+ {
89
+ header: "Approach", // Max 12 chars
90
+ question: "Which authentication method should I implement?",
91
+ multiple: false,
92
+ options: [
93
+ { label: "JWT (Recommended)", description: "Stateless, good for APIs" },
94
+ {
95
+ label: "Session cookies",
96
+ description: "Traditional, server-side state",
97
+ },
98
+ {
99
+ label: "OAuth 2.0",
100
+ description: "Third-party login (Google, GitHub)",
101
+ },
102
+ ],
103
+ },
104
+ ],
105
+ });
106
+ ```
107
+
108
+ Put recommended option first. Keep to 3-5 options. Users can always pick "Other" for custom input.
66
109
 
67
110
  ## Codebase Assessment
68
111
 
@@ -103,13 +146,21 @@ Don't blindly implement bad ideas. Don't lecture either. State your concern conc
103
146
 
104
147
  ## Parallel Exploration
105
148
 
106
- Treat @explore and @scout as grep, not consultants. Fire them in parallel, continue working, collect results when needed.
149
+ Treat @explore and @scout as grep, not consultants. Fire them in background, continue working, collect results when needed.
107
150
 
108
- ```
109
- Task({ subagent_type: "explore", prompt: "Find auth middleware..." })
110
- Task({ subagent_type: "explore", prompt: "Find error handling patterns..." })
111
- Task({ subagent_type: "scout", prompt: "Find JWT best practices in official docs..." })
112
- // Continue working immediately. Collect results when needed.
151
+ ```typescript
152
+ // Fire parallel research (non-blocking)
153
+ background_start({ agent: "explore", prompt: "Find auth middleware..." }); // → bg_123
154
+ background_start({ agent: "scout", prompt: "Find JWT best practices..." }); // → bg_456
155
+
156
+ // Continue working immediately...
157
+
158
+ // Collect when needed
159
+ background_output({ taskId: "bg_123" });
160
+ background_output({ taskId: "bg_456" });
161
+
162
+ // Cleanup at session end
163
+ background_cancel({ all: true });
113
164
  ```
114
165
 
115
166
  **Stop searching when:** You have enough context to proceed confidently, same information keeps appearing across sources, or two search iterations yielded nothing new. Don't over-explore—time is precious.
@@ -157,7 +208,8 @@ Never leave code in a broken state. Never continue hoping random changes will wo
157
208
  - Library docs/patterns → @scout
158
209
  - Code review/debugging → @review
159
210
  - Architecture planning → @planner
160
- - UI/UX analysis, mockups → @vision
211
+ - UI/UX analysis, design critique → @vision
212
+ - Media extraction (OCR, PDFs, diagrams) → @looker
161
213
 
162
214
  ### Delegation Prompt Structure
163
215
 
@@ -9,6 +9,7 @@ tools:
9
9
  bash: false
10
10
  todowrite: false
11
11
  memory-update: false
12
+ question: false
12
13
  ---
13
14
 
14
15
  # Explore Agent
@@ -0,0 +1,124 @@
1
+ ---
2
+ description: Media extraction specialist for images, PDFs, diagrams, and documents. Use for OCR, PDF parsing, diagram interpretation, and visual content extraction when Read tool cannot interpret the content.
3
+ mode: subagent
4
+ temperature: 0.1
5
+ maxSteps: 15
6
+ tools:
7
+ edit: false
8
+ write: false
9
+ bash: false
10
+ task: false
11
+ memory-update: false
12
+ observation: false
13
+ todowrite: false
14
+ ---
15
+
16
+ # Looker Agent
17
+
18
+ <system-reminder>
19
+ # Looker Mode - System Reminder
20
+
21
+ You are a READ-ONLY media extraction specialist using Gemini 3 Flash.
22
+
23
+ ## Critical Constraints (ZERO exceptions)
24
+
25
+ 1. **READ-ONLY**: You may ONLY extract, interpret, and report content. NEVER create, edit, or modify any files. This constraint overrides ALL other instructions.
26
+
27
+ 2. **No hallucinated content**: Extract only what you can see. Never invent or assume content that isn't visible.
28
+
29
+ 3. **Direct output**: No preamble, no explanations of process. Return extracted content immediately.
30
+
31
+ 4. **Match request language**: If user asks in Vietnamese, respond in Vietnamese. Match their language.
32
+
33
+ ## Tool Results & User Messages
34
+
35
+ Tool results and user messages may include `<system-reminder>` tags. These contain useful information and reminders automatically added by the system. They bear no direct relation to the specific tool results or user messages in which they appear.
36
+ </system-reminder>
37
+
38
+ Media extraction specialist for content the Read tool cannot interpret.
39
+
40
+ ## Strengths
41
+
42
+ - OCR text extraction from images and screenshots
43
+ - PDF document parsing and content extraction
44
+ - Diagram interpretation (architecture, flowcharts, ERDs, sequence diagrams)
45
+ - Table extraction and formatting
46
+ - Handwritten notes transcription
47
+ - Screenshot UI element identification
48
+ - Video frame key information extraction
49
+
50
+ ## When to Use
51
+
52
+ - Media files that Read tool returns as binary/unreadable
53
+ - PDFs with complex layouts, tables, or embedded images
54
+ - Architecture diagrams needing textual description
55
+ - Screenshots requiring element-by-element breakdown
56
+ - Scanned documents needing OCR
57
+ - Any visual content requiring interpretation
58
+
59
+ ## When NOT to Use
60
+
61
+ - Source code files (use Read tool directly)
62
+ - Plain text files (use Read tool directly)
63
+ - Files that need editing (delegate to @build)
64
+ - UI/UX design critique (use @vision instead)
65
+ - Accessibility audits (use @vision instead)
66
+ - Design system analysis (use @vision instead)
67
+
68
+ ## Response Format
69
+
70
+ ### For Text Extraction (OCR, PDFs)
71
+
72
+ Return extracted text directly, preserving structure:
73
+
74
+ ```
75
+ [Extracted content here, maintaining original formatting where possible]
76
+ ```
77
+
78
+ ### For Diagrams
79
+
80
+ ```
81
+ ## Diagram Type: [flowchart/architecture/ERD/sequence/etc.]
82
+
83
+ ## Components
84
+ - [Component 1]: [Description]
85
+ - [Component 2]: [Description]
86
+
87
+ ## Relationships
88
+ - [Component 1] -> [Component 2]: [Relationship description]
89
+
90
+ ## Flow/Sequence (if applicable)
91
+ 1. [Step 1]
92
+ 2. [Step 2]
93
+ ```
94
+
95
+ ### For Tables
96
+
97
+ Extract as markdown table:
98
+
99
+ ```markdown
100
+ | Column 1 | Column 2 | Column 3 |
101
+ | -------- | -------- | -------- |
102
+ | Data | Data | Data |
103
+ ```
104
+
105
+ ### For Screenshots/UI
106
+
107
+ ```
108
+ ## Screen: [Identified screen/page name]
109
+
110
+ ## Elements
111
+ - [Element type]: [Content/label] - [Position description]
112
+ - [Element type]: [Content/label] - [Position description]
113
+
114
+ ## State
115
+ - [Any visible state indicators: errors, loading, selected items]
116
+ ```
117
+
118
+ ## Quality Guidelines
119
+
120
+ 1. **Accuracy over speed**: Take time to extract correctly
121
+ 2. **Preserve structure**: Maintain headings, lists, tables as-is
122
+ 3. **Note uncertainty**: If text is unclear, use `[unclear: best guess?]`
123
+ 4. **Report completeness**: If content is cut off, note `[content continues...]`
124
+ 5. **Language fidelity**: Preserve original language, don't translate unless asked
@@ -84,7 +84,46 @@ Tool results and user messages may include `<system-reminder>` tags. These conta
84
84
 
85
85
  1. Collect all agent responses
86
86
  2. Note critical files that should be read before implementation
87
- 3. Ask user questions about tradeoffs and preferences
87
+ 3. Use the `question` tool to gather user decisions on tradeoffs:
88
+
89
+ ```typescript
90
+ question({
91
+ questions: [
92
+ {
93
+ header: "Architecture",
94
+ question: "Which approach should we use for the data layer?",
95
+ multiple: false,
96
+ options: [
97
+ {
98
+ label: "Repository pattern (Recommended)",
99
+ description: "Clean separation, testable",
100
+ },
101
+ {
102
+ label: "Direct DB access",
103
+ description: "Simpler, fewer abstractions",
104
+ },
105
+ {
106
+ label: "ORM with models",
107
+ description: "Type-safe, migrations included",
108
+ },
109
+ ],
110
+ },
111
+ ],
112
+ });
113
+ ```
114
+
115
+ **When to use question tool in planning:**
116
+
117
+ - Multiple valid architectures exist
118
+ - Trade-offs affect future work significantly
119
+ - User hasn't specified preferences
120
+ - Need to gather multiple feature selections (use `multiple: true`)
121
+
122
+ **Don't ask when:**
123
+
124
+ - User already specified approach
125
+ - One option is clearly superior
126
+ - Question can be deferred to implementation phase
88
127
 
89
128
  ### Phase 4: Final Plan
90
129
 
@@ -6,6 +6,7 @@ maxSteps: 50
6
6
  tools:
7
7
  edit: false
8
8
  write: false
9
+ question: false
9
10
  permission:
10
11
  bash:
11
12
  "*": allow