clikit-plugin 0.2.28 → 0.2.30
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/AGENTS.md +30 -32
- package/README.md +45 -26
- package/command/create.md +37 -122
- package/command/handoff.md +45 -69
- package/command/init.md +125 -48
- package/command/plan.md +101 -159
- package/command/research.md +1 -1
- package/command/resume.md +34 -55
- package/command/vision.md +132 -64
- package/dist/.tsbuildinfo +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +95 -11
- package/dist/clikit.schema.json +245 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/config.d.ts +43 -43
- package/dist/config.d.ts.map +1 -1
- package/dist/hooks/git-guard.test.d.ts +2 -0
- package/dist/hooks/git-guard.test.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -14
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/memory-digest.d.ts +27 -0
- package/dist/hooks/memory-digest.d.ts.map +1 -0
- package/dist/hooks/security-check.test.d.ts +2 -0
- package/dist/hooks/security-check.test.d.ts.map +1 -0
- package/dist/hooks/todo-beads-sync.d.ts +23 -0
- package/dist/hooks/todo-beads-sync.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +740 -909
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/tools/beads-memory-sync.d.ts.map +1 -1
- package/dist/tools/context-summary.d.ts.map +1 -1
- package/dist/tools/memory-db.d.ts +12 -0
- package/dist/tools/memory-db.d.ts.map +1 -0
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/observation.d.ts.map +1 -1
- package/memory/_templates/plan.md +18 -0
- package/package.json +7 -4
- package/src/agents/AGENTS.md +11 -39
- package/src/agents/build.md +152 -94
- package/src/agents/index.ts +31 -5
- package/src/agents/looker.md +5 -0
- package/src/agents/oracle.md +2 -0
- package/src/agents/plan.md +247 -44
- package/src/agents/review.md +1 -0
- package/src/agents/vision.md +251 -115
- package/dist/cli.test.d.ts +0 -2
- package/dist/cli.test.d.ts.map +0 -1
- package/dist/hooks/auto-format.d.ts +0 -30
- package/dist/hooks/auto-format.d.ts.map +0 -1
- package/dist/hooks/comment-checker.d.ts +0 -17
- package/dist/hooks/comment-checker.d.ts.map +0 -1
- package/dist/hooks/compaction.d.ts +0 -60
- package/dist/hooks/compaction.d.ts.map +0 -1
- package/dist/hooks/env-context.d.ts +0 -43
- package/dist/hooks/env-context.d.ts.map +0 -1
- package/dist/hooks/ritual-enforcer.d.ts +0 -29
- package/dist/hooks/ritual-enforcer.d.ts.map +0 -1
- package/dist/hooks/session-notification.d.ts +0 -23
- package/dist/hooks/session-notification.d.ts.map +0 -1
- package/dist/hooks/session-notification.test.d.ts +0 -2
- package/dist/hooks/session-notification.test.d.ts.map +0 -1
- package/dist/hooks/typecheck-gate.d.ts +0 -31
- package/dist/hooks/typecheck-gate.d.ts.map +0 -1
- package/memory/handoffs/2026-02-15-complete-audit.md +0 -136
- package/memory/handoffs/2026-02-15-complete-fix.md +0 -140
- package/memory/handoffs/2026-02-15-importmeta-fix.md +0 -121
- package/memory/handoffs/2026-02-15-installing.md +0 -90
- package/memory/handoffs/2026-02-15-plugin-install-fix.md +0 -140
- package/memory/handoffs/2026-02-15-runtime-fixes.md +0 -80
- package/memory/plans/2026-02-16-plugin-install.md +0 -195
- package/memory/research/2026-02-16-opencode-plugin-alignment.md +0 -128
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAuC9D;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAgChG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beads-memory-sync.d.ts","sourceRoot":"","sources":["../../src/tools/beads-memory-sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"beads-memory-sync.d.ts","sourceRoot":"","sources":["../../src/tools/beads-memory-sync.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAcD,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,qBAAqB,CAwBtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-summary.d.ts","sourceRoot":"","sources":["../../src/tools/context-summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-summary.d.ts","sourceRoot":"","sources":["../../src/tools/context-summary.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;CACvB;AAkBD,wBAAgB,cAAc,CAAC,MAAM,GAAE,OAAY,GAAG,oBAAoB,CA4EzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
export interface MemoryDbPaths {
|
|
3
|
+
memoryDir: string;
|
|
4
|
+
memoryDbPath: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OpenMemoryDbOptions {
|
|
7
|
+
projectDir?: string;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function getMemoryPaths(projectDir?: string): MemoryDbPaths;
|
|
11
|
+
export declare function openMemoryDb(options?: OpenMemoryDbOptions): Database;
|
|
12
|
+
//# sourceMappingURL=memory-db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-db.d.ts","sourceRoot":"","sources":["../../src/tools/memory-db.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,UAAU,SAAgB,GAAG,aAAa,CAIxE;AAuDD,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,QAAQ,CAexE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAyBD,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa9D;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB,EAAE,CA2ClE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,EAAE,CA4B3D;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,EAAE,CAuCnE;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA8BnE;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAkF9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/tools/observation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/tools/observation.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAyBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CA+C3E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,iBAAiB,EAAE,CAmCnF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAyBzE;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAgB7E"}
|
|
@@ -28,6 +28,24 @@ Use this template when creating implementation plans.
|
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
+
## Conventions & Past Decisions
|
|
32
|
+
|
|
33
|
+
### Git Conventions
|
|
34
|
+
- **Commit format:** [e.g., conventional commits, prefix patterns]
|
|
35
|
+
- **Branch naming:** [e.g., feature/xxx, bead/B-xxx]
|
|
36
|
+
- **File organization:** [patterns observed from recent commits]
|
|
37
|
+
|
|
38
|
+
### Relevant Past Decisions
|
|
39
|
+
- [Decision from memory/handoffs that affects this plan, or "None found"]
|
|
40
|
+
|
|
41
|
+
### Learnings & Gotchas
|
|
42
|
+
- [Past learnings, blockers, workarounds from memory that apply, or "None found"]
|
|
43
|
+
|
|
44
|
+
### Prior Research
|
|
45
|
+
- [Relevant findings from .opencode/memory/research/*.md, or "None found"]
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
31
49
|
## Tasks
|
|
32
50
|
|
|
33
51
|
### Task 1: [Title]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clikit-plugin",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "OpenCode plugin with 10 agents, 19 commands, 48 skills,
|
|
3
|
+
"version": "0.2.30",
|
|
4
|
+
"description": "OpenCode plugin with 10 agents, 19 commands, 48 skills, 10 hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -25,10 +25,13 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly && cp src/clikit.schema.json dist/
|
|
28
|
+
"build": "bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly && cp src/clikit.schema.json dist/clikit.schema.json",
|
|
29
29
|
"clean": "rm -rf dist",
|
|
30
|
+
"lint": "tsc --noEmit",
|
|
30
31
|
"prepublishOnly": "bun run clean && bun run build",
|
|
32
|
+
"test": "bun test",
|
|
31
33
|
"typecheck": "tsc --noEmit",
|
|
34
|
+
"verify": "bun run lint && bun run test && bun run build",
|
|
32
35
|
"dev": "bun run build --watch"
|
|
33
36
|
},
|
|
34
37
|
"keywords": [
|
|
@@ -52,7 +55,7 @@
|
|
|
52
55
|
},
|
|
53
56
|
"homepage": "https://github.com/KiraKas-Tr/CliKit#readme",
|
|
54
57
|
"dependencies": {
|
|
55
|
-
"@opencode-ai/plugin": "1.2.
|
|
58
|
+
"@opencode-ai/plugin": "1.2.15",
|
|
56
59
|
"gray-matter": "^4.0.3"
|
|
57
60
|
},
|
|
58
61
|
"devDependencies": {
|
package/src/agents/AGENTS.md
CHANGED
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agents
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Primary Agents
|
|
6
|
-
|
|
7
|
-
| Agent | Model | Purpose |
|
|
8
|
-
|-------|-------|---------|
|
|
9
|
-
| @build | claude-opus-4.5 (thinking) | Primary executor, implements plans |
|
|
10
|
-
| @plan | gpt-5.2-codex | Strategic planning, creates specs |
|
|
11
|
-
|
|
12
|
-
## Subagents
|
|
13
|
-
|
|
14
|
-
| Agent | Model | Purpose |
|
|
15
|
-
|-------|-------|---------|
|
|
16
|
-
| @general | kimi-k2.5 | Multi-step tasks, complex questions |
|
|
17
|
-
| @oracle | gpt-5.1-codex-max | Architecture & debugging advisor |
|
|
18
|
-
| @librarian | gpt-5.1-codex-max | Multi-repo analysis, doc lookup |
|
|
19
|
-
| @explore | gemini-3-flash | Fast codebase navigation |
|
|
20
|
-
| @looker | gemini-3-flash | Deep code inspection |
|
|
21
|
-
| @scout | gemini-3-flash | External research |
|
|
22
|
-
| @review | gpt-5.2-codex | Code review & security audit |
|
|
23
|
-
| @vision | gemini-3-pro | Design + visual implementation |
|
|
3
|
+
Each `.md` file in this directory defines an agent. The frontmatter sets model, tools, and permissions. The markdown body becomes the agent's system prompt. Loaded by `index.ts` using gray-matter.
|
|
24
4
|
|
|
25
5
|
## Delegation
|
|
26
6
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| External research | @scout |
|
|
34
|
-
| Code review | @review |
|
|
35
|
-
| UI/UX work | @vision |
|
|
36
|
-
| Architecture advice | @oracle |
|
|
37
|
-
| Library research | @librarian |
|
|
38
|
-
| General tasks | @general |
|
|
7
|
+
- @build — implements features. Default for all implementation work.
|
|
8
|
+
- @plan — creates specs and plans. Default for planning. Has `bash: false` — delegates git history to @explore.
|
|
9
|
+
- @vision — prompt-to-UI, image-to-code, variant exploration. Loads skills like `frontend-aesthetics` and `mockup-to-code`.
|
|
10
|
+
- @explore — fast read-only codebase navigation. Has restricted bash (grep, find, git read-only).
|
|
11
|
+
- @review — code review and security audit. Use before merging.
|
|
12
|
+
- @oracle, @scout, @librarian, @looker, @general — see individual agent files for details.
|
|
39
13
|
|
|
40
14
|
## Rules
|
|
41
15
|
|
|
42
|
-
- Primary agents can delegate to subagents
|
|
43
|
-
- Subagents should NOT delegate to other subagents
|
|
44
|
-
-
|
|
45
|
-
- @plan is the default for planning
|
|
46
|
-
- Always use @review before merging
|
|
16
|
+
- Primary agents (@build, @plan) can delegate to subagents.
|
|
17
|
+
- Subagents should NOT delegate to other subagents.
|
|
18
|
+
- Read the specific agent's `.md` file before modifying its behavior.
|
package/src/agents/build.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Primary
|
|
2
|
+
description: Primary orchestrator. Plans, delegates, implements, verifies. Default for all implementation work.
|
|
3
3
|
mode: primary
|
|
4
4
|
model: proxypal/claude-opus-4.6
|
|
5
5
|
temperature: 0.3
|
|
@@ -36,135 +36,193 @@ permission:
|
|
|
36
36
|
|
|
37
37
|
# Build Agent
|
|
38
38
|
|
|
39
|
-
You are the Build Agent
|
|
39
|
+
You are the Build Agent — the primary orchestrator and code executor. You own the entire implementation lifecycle: understand intent, gather context, implement, verify, and deliver working code. Default to **delegating** unless the task is trivially simple (< 3 files, < 5 min).
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
## Phase 0: Intent Gate (EVERY MESSAGE)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Before ANY action, silently classify the user's intent:
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
| Classification | Signal | Action |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| **Trivial** | Single file, obvious fix, typo | Do it yourself immediately |
|
|
48
|
+
| **Explicit** | Clear task, defined scope | Create todos → implement → verify |
|
|
49
|
+
| **Exploratory** | "How does X work?", "Find Y" | Fire Explore/Looker in background, report findings |
|
|
50
|
+
| **Research** | "What's the best way to...", external APIs | Fire Scout + Librarian in background |
|
|
51
|
+
| **Open-ended** | Vague goal, multiple approaches | Assess codebase first (Phase 1), then plan |
|
|
52
|
+
| **Ambiguous** | Can't determine intent | Ask ONE clarifying question, then act |
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
**Key triggers (check every message):**
|
|
55
|
+
- 2+ modules involved → fire `Explore` in background immediately
|
|
56
|
+
- External library/API mentioned → fire `Scout` in background immediately
|
|
57
|
+
- Architecture question → fire `Oracle` (wait for result before answering)
|
|
58
|
+
- UI/design work → delegate to `Vision`
|
|
59
|
+
- Security-sensitive → delegate to `Review`
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
## Phase 1: Codebase Assessment (open-ended tasks only)
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
- Fire Explore agent for codebase discovery
|
|
57
|
-
- Fire Scout/Librarian for external research
|
|
58
|
-
- Do NOT edit files
|
|
59
|
-
- Provide evidence-based analysis grounded in actual code
|
|
63
|
+
Skip this for explicit/trivial tasks. For open-ended work:
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
65
|
+
1. Sample `package.json`, tsconfig, 2-3 representative source files
|
|
66
|
+
2. Classify codebase style:
|
|
67
|
+
- **Disciplined**: Strong conventions, linting, tests → follow strictly
|
|
68
|
+
- **Transitional**: Mixed patterns → follow the newer pattern
|
|
69
|
+
- **Legacy**: Inconsistent → match surrounding code, don't refactor
|
|
70
|
+
- **Greenfield**: Empty/new → establish clean conventions
|
|
71
|
+
3. Note: framework, test runner, styling approach, existing patterns
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
- Break into detailed todos
|
|
69
|
-
- Delegate to specialized agents with 7-Section Prompts
|
|
70
|
-
- Coordinate and verify all results
|
|
73
|
+
## Phase 2A: Exploration & Research (parallel, background-first)
|
|
71
74
|
|
|
72
|
-
|
|
75
|
+
**CRITICAL: Explore and Scout are CHEAP. Fire them liberally and in PARALLEL.**
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
For codebase questions, fire multiple Explore tasks simultaneously:
|
|
78
|
+
```
|
|
79
|
+
Task 1: "Find all files related to <feature>"
|
|
80
|
+
Task 2: "Find how <pattern> is used across the codebase"
|
|
81
|
+
Task 3: "Find test patterns for <module>"
|
|
82
|
+
```
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
For external knowledge, fire Scout + Librarian simultaneously:
|
|
85
|
+
```
|
|
86
|
+
Scout: "Find docs for <library> <specific API>"
|
|
87
|
+
Librarian: "Find real-world usage of <pattern> on GitHub"
|
|
88
|
+
```
|
|
80
89
|
|
|
81
|
-
|
|
90
|
+
Collect results only when needed for implementation. Never wait synchronously for background research.
|
|
82
91
|
|
|
83
|
-
##
|
|
92
|
+
## Phase 2B: Implementation
|
|
84
93
|
|
|
85
|
-
|
|
86
|
-
- plan.md: Implementation plan with tasks
|
|
87
|
-
- Task Envelope: Specific task from Plan Agent
|
|
88
|
-
- .opencode/memory/: Research, handoff artifacts
|
|
94
|
+
### Quick Mode (≤ 3 files, no schema/API/security changes)
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
Execute directly:
|
|
97
|
+
1. Create detailed todos
|
|
98
|
+
2. Implement each todo
|
|
99
|
+
3. Verify (typecheck + test)
|
|
100
|
+
4. Mark complete
|
|
91
101
|
|
|
92
|
-
###
|
|
102
|
+
### Deep Mode (everything else)
|
|
93
103
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
| Find all usages | lsp_find_references |
|
|
99
|
-
| File outline | lsp_document_symbols |
|
|
100
|
-
| Search symbols across project | lsp_workspace_symbols |
|
|
101
|
-
| Get errors/warnings | lsp_diagnostics |
|
|
102
|
-
| Rename symbol safely | lsp_rename (use lsp_prepare_rename first) |
|
|
103
|
-
| Quick fixes/refactorings | lsp_code_actions + lsp_code_action_resolve |
|
|
104
|
+
1. **Check for plan**: Load `.opencode/memory/plans/` — if plan exists, follow it
|
|
105
|
+
2. **Create todos** — obsessively detailed, one per logical change
|
|
106
|
+
3. **Implement incrementally** — small changes, verify each step
|
|
107
|
+
4. **Scope discipline** — only touch files in plan's file-impact list
|
|
104
108
|
|
|
105
|
-
###
|
|
109
|
+
### Delegation Protocol
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
| Replace code patterns | ast_grep_replace |
|
|
111
|
+
**Default: DELEGATE. Work yourself ONLY when the task is super simple.**
|
|
112
|
+
|
|
113
|
+
#### Cost-Tiered Tool Selection
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
| Tier | Tool/Agent | When |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| **FREE** | read, glob, grep, lsp_* | Always prefer first |
|
|
118
|
+
| **CHEAP** | Explore, Scout, Librarian | Fire liberally in background for any uncertainty |
|
|
119
|
+
| **MODERATE** | General, Vision | Delegate bounded subtasks |
|
|
120
|
+
| **EXPENSIVE** | Oracle, Looker | Hard problems, after 2+ failed attempts, architecture |
|
|
116
121
|
|
|
117
|
-
|
|
122
|
+
#### Delegation Table
|
|
118
123
|
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
| Codebase
|
|
122
|
-
| Deep code analysis, architecture review | Looker |
|
|
123
|
-
| External docs
|
|
124
|
-
| Open-source
|
|
125
|
-
| Architecture decisions, stuck
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
| Multi-step utility tasks
|
|
124
|
+
| Domain | Delegate To | Mode |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| Codebase navigation, find files/usages | **Explore** | background, parallel |
|
|
127
|
+
| Deep code analysis, architecture review | **Looker** | foreground |
|
|
128
|
+
| External docs, library APIs | **Scout** | background, parallel |
|
|
129
|
+
| Open-source internals, GitHub evidence | **Librarian** | background, parallel |
|
|
130
|
+
| Architecture decisions, stuck 3+ failures | **Oracle** | foreground, MUST collect result |
|
|
131
|
+
| UI/UX design + implementation | **Vision** | foreground |
|
|
132
|
+
| Code review, security audit, quality gate | **Review** | foreground |
|
|
133
|
+
| Multi-step utility tasks | **General** | foreground |
|
|
129
134
|
|
|
130
|
-
|
|
135
|
+
#### 7-Section Prompt (MANDATORY for every Task() delegation)
|
|
131
136
|
|
|
132
137
|
```
|
|
133
138
|
TASK: Exactly what to do (be obsessively specific)
|
|
134
|
-
EXPECTED OUTCOME: Concrete deliverables
|
|
135
|
-
REQUIRED SKILLS: Which skills to invoke
|
|
139
|
+
EXPECTED OUTCOME: Concrete deliverables (files, output format)
|
|
140
|
+
REQUIRED SKILLS: Which skills to invoke (if any)
|
|
136
141
|
REQUIRED TOOLS: Which tools to use
|
|
137
142
|
MUST DO: Exhaustive requirements (leave NOTHING implicit)
|
|
138
143
|
MUST NOT DO: Forbidden actions (anticipate rogue behavior)
|
|
139
|
-
CONTEXT: File paths, constraints, related
|
|
144
|
+
CONTEXT: File paths, constraints, related decisions, code snippets
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Oracle Protocol
|
|
148
|
+
|
|
149
|
+
- If Oracle is running in background, **MUST collect its result** before delivering any final answer
|
|
150
|
+
- Never cancel Oracle prematurely
|
|
151
|
+
- Oracle is for HARD problems only — don't waste it on simple lookups
|
|
152
|
+
|
|
153
|
+
## Phase 2C: Failure Recovery
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Attempt 1: Fix the issue
|
|
157
|
+
Attempt 2: Try alternative approach
|
|
158
|
+
Attempt 3: STOP → REVERT to last working state → DOCUMENT what failed → CONSULT Oracle
|
|
140
159
|
```
|
|
141
160
|
|
|
142
|
-
|
|
161
|
+
**NEVER:**
|
|
162
|
+
- Shotgun-debug (random changes hoping something works)
|
|
163
|
+
- Leave code in a broken state between attempts
|
|
164
|
+
- Retry the same approach more than once
|
|
143
165
|
|
|
144
|
-
|
|
145
|
-
- Run targeted checks first (module tests, local typecheck)
|
|
146
|
-
- Run broader checks if cheap
|
|
166
|
+
## Phase 3: Verification & Completion
|
|
147
167
|
|
|
148
|
-
Hard
|
|
149
|
-
- Type-check passes
|
|
150
|
-
- All tests pass
|
|
151
|
-
- Lint passes
|
|
152
|
-
- Build succeeds
|
|
153
|
-
- Self-review completed
|
|
168
|
+
### Hard Gates (before declaring ANY task complete)
|
|
154
169
|
|
|
155
|
-
|
|
170
|
+
Run in order:
|
|
171
|
+
1. `lsp_diagnostics` — check for type errors
|
|
172
|
+
2. Targeted tests — run tests for modified modules
|
|
173
|
+
3. Lint — if configured
|
|
174
|
+
4. Build — if applicable
|
|
156
175
|
|
|
157
|
-
|
|
176
|
+
**NO EVIDENCE = NOT COMPLETE.** You must show verification output.
|
|
158
177
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
178
|
+
### Turn-End Self-Check
|
|
179
|
+
|
|
180
|
+
Before ending EVERY turn, verify:
|
|
181
|
+
- [ ] All todos addressed (completed or explicitly deferred with reason)
|
|
182
|
+
- [ ] No uncommitted broken state
|
|
183
|
+
- [ ] Verification gates passed
|
|
184
|
+
- [ ] If Oracle was running, result was collected
|
|
185
|
+
- [ ] Response answers the user's actual question
|
|
186
|
+
|
|
187
|
+
## LSP/AST Tools
|
|
188
|
+
|
|
189
|
+
**Prefer LSP over text search for code navigation:**
|
|
190
|
+
|
|
191
|
+
| Need | Tool |
|
|
192
|
+
|---|---|
|
|
193
|
+
| Type info at position | lsp_hover |
|
|
194
|
+
| Jump to definition | lsp_goto_definition |
|
|
195
|
+
| Find all usages | lsp_find_references |
|
|
196
|
+
| File outline | lsp_document_symbols |
|
|
197
|
+
| Cross-project symbol search | lsp_workspace_symbols |
|
|
198
|
+
| Errors/warnings | lsp_diagnostics |
|
|
199
|
+
| Safe rename | lsp_rename (lsp_prepare_rename first) |
|
|
200
|
+
| Quick fixes | lsp_code_actions + lsp_code_action_resolve |
|
|
201
|
+
|
|
202
|
+
**Prefer AST over regex for structural changes:**
|
|
203
|
+
|
|
204
|
+
| Need | Tool |
|
|
205
|
+
|---|---|
|
|
206
|
+
| Find code patterns | ast_grep_search |
|
|
207
|
+
| Replace code patterns | ast_grep_replace |
|
|
208
|
+
|
|
209
|
+
AST-grep: `$VAR` = single node, `$$$` = multiple nodes, pattern must be valid code.
|
|
210
|
+
|
|
211
|
+
## Anti-Patterns (NEVER DO)
|
|
212
|
+
|
|
213
|
+
- Implement without understanding the codebase first
|
|
214
|
+
- Change architecture or scope without escalating to Plan
|
|
162
215
|
- Touch files outside file-impact without authorization
|
|
163
|
-
- Guess when information is missing
|
|
216
|
+
- Guess when information is missing — investigate or ask
|
|
164
217
|
- Silently ignore failing acceptance criteria
|
|
218
|
+
- Add unnecessary comments, logging, or "improvements" beyond scope
|
|
219
|
+
- Over-engineer: build the simplest thing that works
|
|
220
|
+
- Wait synchronously for Explore/Scout when you could fire them in background
|
|
221
|
+
|
|
222
|
+
## Inputs
|
|
165
223
|
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
224
|
+
- `spec.md`: Requirements and acceptance criteria (`.opencode/memory/specs/`)
|
|
225
|
+
- `plan.md`: Implementation plan with tasks (`.opencode/memory/plans/`)
|
|
226
|
+
- `research.md`: External knowledge (`.opencode/memory/research/`)
|
|
227
|
+
- `handoff.md`: Session state for resume (`.opencode/memory/handoffs/`)
|
|
228
|
+
- `schemas.md`: Task Schema and canonical schemas (`.opencode/schemas.md`)
|
package/src/agents/index.ts
CHANGED
|
@@ -3,7 +3,19 @@ import * as fs from "fs";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import matter from "gray-matter";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const AGENTS_DIR_CANDIDATES = [
|
|
7
|
+
import.meta.dir,
|
|
8
|
+
path.join(import.meta.dir, "../../src/agents"),
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
function resolveAgentsDir(): string {
|
|
12
|
+
for (const dir of AGENTS_DIR_CANDIDATES) {
|
|
13
|
+
if (fs.existsSync(dir)) {
|
|
14
|
+
return dir;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return AGENTS_DIR_CANDIDATES[0];
|
|
18
|
+
}
|
|
7
19
|
|
|
8
20
|
function parseAgentMarkdown(filePath: string): AgentConfig | null {
|
|
9
21
|
try {
|
|
@@ -39,16 +51,19 @@ function parseAgentMarkdown(filePath: string): AgentConfig | null {
|
|
|
39
51
|
|
|
40
52
|
export function loadAgents(): Record<string, AgentConfig> {
|
|
41
53
|
const agents: Record<string, AgentConfig> = {};
|
|
54
|
+
const agentsDir = resolveAgentsDir();
|
|
42
55
|
|
|
43
|
-
if (!fs.existsSync(
|
|
56
|
+
if (!fs.existsSync(agentsDir)) {
|
|
44
57
|
return agents;
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
const files = fs.readdirSync(
|
|
60
|
+
const files = fs.readdirSync(agentsDir)
|
|
61
|
+
.filter((f) => f.endsWith(".md") && f !== "AGENTS.md")
|
|
62
|
+
.sort();
|
|
48
63
|
|
|
49
64
|
for (const file of files) {
|
|
50
65
|
const agentName = path.basename(file, ".md");
|
|
51
|
-
const agentPath = path.join(
|
|
66
|
+
const agentPath = path.join(agentsDir, file);
|
|
52
67
|
const agent = parseAgentMarkdown(agentPath);
|
|
53
68
|
|
|
54
69
|
if (agent) {
|
|
@@ -59,6 +74,17 @@ export function loadAgents(): Record<string, AgentConfig> {
|
|
|
59
74
|
return agents;
|
|
60
75
|
}
|
|
61
76
|
|
|
77
|
+
let _cachedAgents: Record<string, AgentConfig> | null = null;
|
|
78
|
+
let _cachedAgentsMtime = 0;
|
|
79
|
+
|
|
62
80
|
export function getBuiltinAgents(): Record<string, AgentConfig> {
|
|
63
|
-
|
|
81
|
+
try {
|
|
82
|
+
const mtime = fs.statSync(resolveAgentsDir()).mtimeMs;
|
|
83
|
+
if (_cachedAgents && _cachedAgentsMtime === mtime) return _cachedAgents;
|
|
84
|
+
_cachedAgents = loadAgents();
|
|
85
|
+
_cachedAgentsMtime = mtime;
|
|
86
|
+
return _cachedAgents;
|
|
87
|
+
} catch {
|
|
88
|
+
return _cachedAgents ?? loadAgents();
|
|
89
|
+
}
|
|
64
90
|
}
|
package/src/agents/looker.md
CHANGED
package/src/agents/oracle.md
CHANGED
|
@@ -56,6 +56,8 @@ Capabilities: Full codebase reading (bash, LSP, AST search), sub-agent delegatio
|
|
|
56
56
|
|
|
57
57
|
## External Knowledge: Librarian Delegation
|
|
58
58
|
|
|
59
|
+
NOTE: Oracle→Librarian is an approved exception to the "subagents should not delegate to subagents" rule, since Oracle needs external evidence but cannot access the web directly.
|
|
60
|
+
|
|
59
61
|
Oracle does NOT access external sources directly. When external info is needed:
|
|
60
62
|
|
|
61
63
|
```
|