zenox 1.2.3 → 1.3.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 CHANGED
@@ -17,6 +17,16 @@
17
17
 
18
18
  Zenox supercharges [OpenCode](https://opencode.ai) with specialized AI agents that handle different aspects of development. Instead of one agent doing everything, you get a team of experts — each optimized for their domain.
19
19
 
20
+ ## Features
21
+
22
+ - **4 Specialized Agents** — Explorer, Librarian, Oracle, UI Planner
23
+ - **Background Tasks** — Fire multiple agents in parallel
24
+ - **Keyword Triggers** — `ultrawork`, `deep research`, `explore codebase`
25
+ - **Session History** — Query past sessions to learn from previous work
26
+ - **Code Intelligence** — Search symbols via LSP
27
+ - **Todo Continuation** — Auto-reminds when tasks are incomplete
28
+ - **Auto-Updates** — Toast notification when new version available
29
+
20
30
  ## Why Zenox?
21
31
 
22
32
  Most AI coding assistants use a single model for everything. Zenox takes a different approach:
@@ -114,6 +124,46 @@ Zenox shows toast notifications for background task events:
114
124
  - 🎉 **All Complete** — Shows summary of all finished tasks
115
125
  - ❌ **Task Failed** — Shows error message
116
126
 
127
+ ## Session History
128
+
129
+ Query past sessions to learn from previous work:
130
+
131
+ | Tool | What it does |
132
+ |------|--------------|
133
+ | `session_list` | List recent sessions to find relevant past work |
134
+ | `session_search` | Search messages across sessions for how something was done |
135
+
136
+ ```
137
+ You: "How did we implement auth last time?"
138
+ → session_search({ query: "authentication" })
139
+ → Finds excerpts from past sessions where auth was discussed
140
+ ```
141
+
142
+ ## Code Intelligence
143
+
144
+ Search for symbols via LSP (Language Server Protocol):
145
+
146
+ | Tool | What it does |
147
+ |------|--------------|
148
+ | `find_symbols` | Search for functions, classes, variables by name |
149
+ | `lsp_status` | Check which language servers are running |
150
+
151
+ ```
152
+ You: "Find where handleLogin is defined"
153
+ → find_symbols({ query: "handleLogin" })
154
+ → Returns: Function in src/auth/handlers.ts, line 42
155
+ ```
156
+
157
+ ## Todo Continuation
158
+
159
+ Zenox automatically reminds you to continue working when:
160
+
161
+ - You have incomplete tasks in your todo list
162
+ - The session goes idle
163
+ - There's been enough time since the last reminder (10 second cooldown)
164
+
165
+ This keeps you on track without manual intervention. The agent will be prompted to continue until all todos are complete or blocked.
166
+
117
167
  ## Configuration
118
168
 
119
169
  ### Custom Models
@@ -1,3 +1,4 @@
1
1
  export { createAutoUpdateHook } from "./auto-update";
2
2
  export { createKeywordDetectorHook } from "./keyword-detector";
3
+ export { createTodoEnforcerHook } from "./todo-enforcer";
3
4
  export type { KeywordType, KeywordConfig } from "./keyword-detector";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Todo Continuation Enforcer Hook
3
+ *
4
+ * Automatically reminds the agent to continue working when:
5
+ * - Session goes idle (session.idle event)
6
+ * - There are incomplete todos (pending or in_progress)
7
+ *
8
+ * Features:
9
+ * - Skips child sessions (background tasks)
10
+ * - Cooldown to prevent spam (10 seconds between reminders)
11
+ * - Shows toast notification when enforcing
12
+ *
13
+ * Inspired by oh-my-opencode's todo-continuation-enforcer
14
+ */
15
+ import type { PluginInput } from "@opencode-ai/plugin";
16
+ import type { Event } from "@opencode-ai/sdk";
17
+ interface SessionState {
18
+ lastEnforcedAt: number;
19
+ enforceCount: number;
20
+ }
21
+ export declare function createTodoEnforcerHook(ctx: PluginInput): {
22
+ event: ({ event }: {
23
+ event: Event;
24
+ }) => Promise<void>;
25
+ };
26
+ export type { SessionState };
package/dist/index.js CHANGED
@@ -743,6 +743,85 @@ Include these keywords in your prompt to unlock special modes:
743
743
  | \`ultrawork\` or \`ulw\` | Maximum multi-agent coordination - aggressive parallel research |
744
744
  | \`deep research\` | Comprehensive exploration - fires 3-4 background agents |
745
745
  | \`explore codebase\` | Codebase mapping - multiple explorers in parallel |
746
+
747
+ ---
748
+
749
+ ## Session History Tools
750
+
751
+ You have tools to learn from past work sessions:
752
+
753
+ | Tool | Use For |
754
+ |------|---------|
755
+ | \`session_list\` | List recent sessions to find relevant past work |
756
+ | \`session_search\` | Search messages across sessions for how something was done |
757
+
758
+ ### When to Use Session Tools
759
+
760
+ - **Before implementing unfamiliar features** \u2014 search if done before
761
+ - **When user says "like before" or "last time"** \u2014 find that session
762
+ - **When debugging** \u2014 check if similar issues were solved previously
763
+ - **For context on ongoing projects** \u2014 understand recent work history
764
+
765
+ ### Example Usage
766
+
767
+ \`\`\`
768
+ // Find how authentication was implemented before
769
+ session_search({ query: "JWT authentication" })
770
+
771
+ // List recent sessions to understand project context
772
+ session_list({ limit: 5 })
773
+
774
+ // Find past implementations of a feature
775
+ session_search({ query: "rate limiting" })
776
+ \`\`\`
777
+
778
+ ---
779
+
780
+ ## Code Intelligence Tools
781
+
782
+ You have tools to understand code structure via LSP:
783
+
784
+ | Tool | Use For |
785
+ |------|---------|
786
+ | \`find_symbols\` | Search for functions, classes, variables by name |
787
+ | \`lsp_status\` | Check which language servers are running |
788
+
789
+ ### When to Use Code Intelligence
790
+
791
+ - **Before editing code** \u2014 find the symbol's definition location
792
+ - **When refactoring** \u2014 search for related symbols
793
+ - **To understand project structure** \u2014 search for key symbols like "auth", "user", "api"
794
+ - **To verify LSP availability** \u2014 check if code intelligence is working
795
+
796
+ ### Example Usage
797
+
798
+ \`\`\`
799
+ // Find all auth-related functions/classes
800
+ find_symbols({ query: "auth" })
801
+
802
+ // Find a specific function
803
+ find_symbols({ query: "handleLogin" })
804
+
805
+ // Check LSP server status
806
+ lsp_status()
807
+ \`\`\`
808
+
809
+ ---
810
+
811
+ ## Todo Continuation
812
+
813
+ The system automatically reminds you if you go idle with incomplete tasks.
814
+
815
+ **Best Practices:**
816
+ - Keep your todo list updated with \`TodoWrite\`
817
+ - Mark tasks complete immediately when finished
818
+ - Use clear, actionable task descriptions
819
+ - The system will prompt you to continue if tasks remain incomplete
820
+
821
+ **Note:** You don't need to invoke the todo enforcer \u2014 it runs automatically when:
822
+ - You have pending or in-progress todos
823
+ - The session goes idle
824
+ - There's been sufficient time since the last reminder
746
825
  `;
747
826
 
748
827
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
@@ -17706,6 +17785,111 @@ ${primaryKeyword.context}`;
17706
17785
  }
17707
17786
  };
17708
17787
  }
17788
+ // src/hooks/todo-enforcer/index.ts
17789
+ var COOLDOWN_MS = 1e4;
17790
+ var TOAST_DURATION3 = 3000;
17791
+ var CONTINUATION_PROMPT = `[TODO CONTINUATION REMINDER]
17792
+
17793
+ You have incomplete tasks in your todo list. Continue working on them.
17794
+
17795
+ Rules:
17796
+ - Proceed without asking for permission
17797
+ - Mark each task complete when finished
17798
+ - Update todo status as you work
17799
+ - Do not stop until all tasks are done or blocked`;
17800
+ function createTodoEnforcerHook(ctx) {
17801
+ const sessionStates = new Map;
17802
+ const cleanupOldStates = () => {
17803
+ const now = Date.now();
17804
+ const maxAge = 30 * 60 * 1000;
17805
+ for (const [sessionID, state] of sessionStates) {
17806
+ if (now - state.lastEnforcedAt > maxAge) {
17807
+ sessionStates.delete(sessionID);
17808
+ }
17809
+ }
17810
+ };
17811
+ return {
17812
+ event: async ({ event }) => {
17813
+ if (event.type !== "session.idle")
17814
+ return;
17815
+ const props = event.properties;
17816
+ const sessionID = props?.sessionID;
17817
+ if (!sessionID)
17818
+ return;
17819
+ let state = sessionStates.get(sessionID);
17820
+ if (!state) {
17821
+ state = { lastEnforcedAt: 0, enforceCount: 0 };
17822
+ sessionStates.set(sessionID, state);
17823
+ }
17824
+ const now = Date.now();
17825
+ if (now - state.lastEnforcedAt < COOLDOWN_MS) {
17826
+ return;
17827
+ }
17828
+ try {
17829
+ const sessionResult = await ctx.client.session.get({
17830
+ path: { id: sessionID }
17831
+ });
17832
+ const session = sessionResult.data;
17833
+ if (session?.parentID) {
17834
+ return;
17835
+ }
17836
+ } catch {
17837
+ return;
17838
+ }
17839
+ let todos = [];
17840
+ try {
17841
+ const todosResult = await ctx.client.session.todo({
17842
+ path: { id: sessionID }
17843
+ });
17844
+ todos = todosResult.data ?? [];
17845
+ } catch {
17846
+ return;
17847
+ }
17848
+ if (todos.length === 0) {
17849
+ return;
17850
+ }
17851
+ const incomplete = todos.filter((t) => t.status === "pending" || t.status === "in_progress");
17852
+ if (incomplete.length === 0) {
17853
+ return;
17854
+ }
17855
+ state.lastEnforcedAt = now;
17856
+ state.enforceCount++;
17857
+ const todoList = incomplete.map((t) => {
17858
+ const priority = t.priority === "high" ? "!" : "";
17859
+ return `- [${t.status}]${priority} ${t.content}`;
17860
+ }).join(`
17861
+ `);
17862
+ const completedCount = todos.length - incomplete.length;
17863
+ const statusLine = `[Status: ${completedCount}/${todos.length} completed, ${incomplete.length} remaining]`;
17864
+ const prompt = `${CONTINUATION_PROMPT}
17865
+
17866
+ Current incomplete tasks:
17867
+ ${todoList}
17868
+
17869
+ ${statusLine}`;
17870
+ try {
17871
+ await ctx.client.session.prompt({
17872
+ path: { id: sessionID },
17873
+ body: {
17874
+ noReply: false,
17875
+ parts: [{ type: "text", text: prompt }]
17876
+ }
17877
+ });
17878
+ await ctx.client.tui.showToast({
17879
+ body: {
17880
+ title: "\uD83D\uDCCB Todo Reminder",
17881
+ message: `${incomplete.length} task(s) remaining`,
17882
+ variant: "info",
17883
+ duration: TOAST_DURATION3
17884
+ }
17885
+ }).catch(() => {});
17886
+ } catch {}
17887
+ if (sessionStates.size > 50) {
17888
+ cleanupOldStates();
17889
+ }
17890
+ }
17891
+ };
17892
+ }
17709
17893
  // src/features/task-toast/manager.ts
17710
17894
  var LAUNCH_TOAST_DURATION = 3000;
17711
17895
  var COMPLETE_TOAST_DURATION = 4000;
@@ -17825,6 +18009,200 @@ Use background_output to retrieve.`,
17825
18009
  return this.tasks.get(taskId);
17826
18010
  }
17827
18011
  }
18012
+ // src/tools/session/tools.ts
18013
+ var MAX_SESSIONS_TO_SEARCH = 10;
18014
+ var DEFAULT_SEARCH_LIMIT = 20;
18015
+ var DEFAULT_LIST_LIMIT = 10;
18016
+ function createSessionTools(client) {
18017
+ const sessionList = tool({
18018
+ description: `List recent sessions to find relevant past work.
18019
+ Use when you need to see what was done before or find a specific session.
18020
+ Returns session IDs, titles, and creation dates.`,
18021
+ args: {
18022
+ limit: tool.schema.number().optional().describe("Max sessions to return (default: 10)")
18023
+ },
18024
+ async execute(args) {
18025
+ try {
18026
+ const result = await client.session.list();
18027
+ const sessions = result.data ?? [];
18028
+ const mainSessions = sessions.filter((s) => !s.parentID).slice(0, args.limit ?? DEFAULT_LIST_LIMIT);
18029
+ if (mainSessions.length === 0) {
18030
+ return "No sessions found.";
18031
+ }
18032
+ const formatted = mainSessions.map((s) => ({
18033
+ id: s.id,
18034
+ title: s.title ?? "(untitled)",
18035
+ created: s.time?.created ? new Date(s.time.created).toISOString() : "unknown"
18036
+ }));
18037
+ return JSON.stringify(formatted, null, 2);
18038
+ } catch (err) {
18039
+ const errorMsg = err instanceof Error ? err.message : "Unknown error";
18040
+ return `Failed to list sessions: ${errorMsg}`;
18041
+ }
18042
+ }
18043
+ });
18044
+ const sessionSearch = tool({
18045
+ description: `Search messages across sessions to find how something was done before.
18046
+ Use when looking for past implementations, solutions, or context.
18047
+ Searches the last 10 sessions for matching content.`,
18048
+ args: {
18049
+ query: tool.schema.string().describe("Search query (case-insensitive)"),
18050
+ limit: tool.schema.number().optional().describe("Max results to return (default: 20)")
18051
+ },
18052
+ async execute(args) {
18053
+ try {
18054
+ const sessionsResult = await client.session.list();
18055
+ const sessions = sessionsResult.data ?? [];
18056
+ const searchSessions = sessions.filter((s) => !s.parentID).slice(0, MAX_SESSIONS_TO_SEARCH);
18057
+ if (searchSessions.length === 0) {
18058
+ return "No sessions to search.";
18059
+ }
18060
+ const query = args.query.toLowerCase();
18061
+ const maxResults = args.limit ?? DEFAULT_SEARCH_LIMIT;
18062
+ const results = [];
18063
+ for (const session of searchSessions) {
18064
+ if (results.length >= maxResults)
18065
+ break;
18066
+ try {
18067
+ const messagesResult = await client.session.messages({
18068
+ path: { id: session.id },
18069
+ query: { limit: 50 }
18070
+ });
18071
+ const messages = messagesResult.data ?? [];
18072
+ for (const msg of messages) {
18073
+ if (results.length >= maxResults)
18074
+ break;
18075
+ const textParts = msg.parts?.filter((p) => p.type === "text" && p.text) ?? [];
18076
+ for (const part of textParts) {
18077
+ if (results.length >= maxResults)
18078
+ break;
18079
+ const text = part.text ?? "";
18080
+ if (text.toLowerCase().includes(query)) {
18081
+ const lowerText = text.toLowerCase();
18082
+ const matchIndex = lowerText.indexOf(query);
18083
+ const start = Math.max(0, matchIndex - 50);
18084
+ const end = Math.min(text.length, matchIndex + query.length + 150);
18085
+ const excerpt = (start > 0 ? "..." : "") + text.substring(start, end).trim() + (end < text.length ? "..." : "");
18086
+ results.push({
18087
+ sessionId: session.id,
18088
+ sessionTitle: session.title ?? "(untitled)",
18089
+ role: msg.info?.role ?? "unknown",
18090
+ excerpt
18091
+ });
18092
+ }
18093
+ }
18094
+ }
18095
+ } catch {
18096
+ continue;
18097
+ }
18098
+ }
18099
+ if (results.length === 0) {
18100
+ return `No matches found for "${args.query}" in the last ${MAX_SESSIONS_TO_SEARCH} sessions.`;
18101
+ }
18102
+ return JSON.stringify(results, null, 2);
18103
+ } catch (err) {
18104
+ const errorMsg = err instanceof Error ? err.message : "Unknown error";
18105
+ return `Failed to search sessions: ${errorMsg}`;
18106
+ }
18107
+ }
18108
+ });
18109
+ return {
18110
+ session_list: sessionList,
18111
+ session_search: sessionSearch
18112
+ };
18113
+ }
18114
+ // src/tools/code-intelligence/tools.ts
18115
+ var SYMBOL_KINDS = {
18116
+ 1: "File",
18117
+ 2: "Module",
18118
+ 3: "Namespace",
18119
+ 4: "Package",
18120
+ 5: "Class",
18121
+ 6: "Method",
18122
+ 7: "Property",
18123
+ 8: "Field",
18124
+ 9: "Constructor",
18125
+ 10: "Enum",
18126
+ 11: "Interface",
18127
+ 12: "Function",
18128
+ 13: "Variable",
18129
+ 14: "Constant",
18130
+ 15: "String",
18131
+ 16: "Number",
18132
+ 17: "Boolean",
18133
+ 18: "Array",
18134
+ 19: "Object",
18135
+ 20: "Key",
18136
+ 21: "Null",
18137
+ 22: "EnumMember",
18138
+ 23: "Struct",
18139
+ 24: "Event",
18140
+ 25: "Operator",
18141
+ 26: "TypeParameter"
18142
+ };
18143
+ function createCodeIntelligenceTools(client) {
18144
+ const findSymbols = tool({
18145
+ description: `Search for functions, classes, variables, and other symbols by name.
18146
+ Use to find where something is defined or to understand code structure.
18147
+ Returns symbol name, type (function/class/etc), file path, and location.`,
18148
+ args: {
18149
+ query: tool.schema.string().describe("Symbol name or pattern to search (e.g., 'handleAuth', 'User')")
18150
+ },
18151
+ async execute(args) {
18152
+ try {
18153
+ const result = await client.find.symbols({
18154
+ query: { query: args.query }
18155
+ });
18156
+ const symbols = result.data ?? [];
18157
+ if (symbols.length === 0) {
18158
+ return `No symbols found matching "${args.query}"`;
18159
+ }
18160
+ const formatted = symbols.map((s) => {
18161
+ const uri = s.location?.uri ?? "";
18162
+ const path2 = uri.startsWith("file://") ? uri.slice(7) : uri;
18163
+ return {
18164
+ name: s.name,
18165
+ kind: SYMBOL_KINDS[s.kind] ?? `Unknown(${s.kind})`,
18166
+ path: path2,
18167
+ location: s.location?.range ? `line ${s.location.range.start.line + 1}` : "unknown"
18168
+ };
18169
+ });
18170
+ return JSON.stringify(formatted, null, 2);
18171
+ } catch (err) {
18172
+ const errorMsg = err instanceof Error ? err.message : "Unknown error";
18173
+ return `Failed to search symbols: ${errorMsg}`;
18174
+ }
18175
+ }
18176
+ });
18177
+ const lspStatus = tool({
18178
+ description: `Get the status of language servers (LSP).
18179
+ Use to check if code intelligence is available for the current project's languages.
18180
+ Shows which LSP servers are running and their status.`,
18181
+ args: {},
18182
+ async execute() {
18183
+ try {
18184
+ const result = await client.lsp.status();
18185
+ const servers = result.data ?? [];
18186
+ if (servers.length === 0) {
18187
+ return "No LSP servers currently running.";
18188
+ }
18189
+ const formatted = servers.map((s) => ({
18190
+ name: s.name ?? s.id,
18191
+ status: s.status,
18192
+ root: s.root
18193
+ }));
18194
+ return JSON.stringify(formatted, null, 2);
18195
+ } catch (err) {
18196
+ const errorMsg = err instanceof Error ? err.message : "Unknown error";
18197
+ return `Failed to get LSP status: ${errorMsg}`;
18198
+ }
18199
+ }
18200
+ });
18201
+ return {
18202
+ find_symbols: findSymbols,
18203
+ lsp_status: lspStatus
18204
+ };
18205
+ }
17828
18206
  // src/index.ts
17829
18207
  var ZenoxPlugin = async (ctx) => {
17830
18208
  const pluginConfig = loadPluginConfig(ctx.directory);
@@ -17836,6 +18214,9 @@ var ZenoxPlugin = async (ctx) => {
17836
18214
  const backgroundTools = createBackgroundTools(backgroundManager, ctx.client);
17837
18215
  const autoUpdateHook = createAutoUpdateHook(ctx);
17838
18216
  const keywordDetectorHook = createKeywordDetectorHook(ctx);
18217
+ const todoEnforcerHook = createTodoEnforcerHook(ctx);
18218
+ const sessionTools = createSessionTools(ctx.client);
18219
+ const codeIntelligenceTools = createCodeIntelligenceTools(ctx.client);
17839
18220
  const applyModelOverride = (agentName, baseAgent) => {
17840
18221
  const override = pluginConfig.agents?.[agentName];
17841
18222
  if (override?.model) {
@@ -17844,7 +18225,11 @@ var ZenoxPlugin = async (ctx) => {
17844
18225
  return baseAgent;
17845
18226
  };
17846
18227
  return {
17847
- tool: backgroundTools,
18228
+ tool: {
18229
+ ...backgroundTools,
18230
+ ...sessionTools,
18231
+ ...codeIntelligenceTools
18232
+ },
17848
18233
  "chat.message": async (input, output) => {
17849
18234
  await keywordDetectorHook["chat.message"]?.(input, output);
17850
18235
  },
@@ -17876,7 +18261,9 @@ var ZenoxPlugin = async (ctx) => {
17876
18261
  }
17877
18262
  });
17878
18263
  }
18264
+ return;
17879
18265
  }
18266
+ await todoEnforcerHook.event(input);
17880
18267
  }
17881
18268
  },
17882
18269
  config: async (config2) => {
@@ -2,4 +2,4 @@
2
2
  * Orchestration prompt to inject into Build and Plan agents.
3
3
  * This teaches the primary agents how to delegate to specialized subagents using the Task tool.
4
4
  */
5
- export declare const ORCHESTRATION_PROMPT = "\n\n---\n\n## Sub-Agent Delegation\n\nYou have specialized subagents. Use the **Task tool** to delegate work proactively.\n\n### Available Agents\n\n| Agent | Use For | subagent_type |\n|-------|---------|---------------|\n| **Explorer** | Codebase grep - fast pattern matching, \"Where is X?\" | `explorer` |\n| **Librarian** | External grep - docs, GitHub, OSS examples | `librarian` |\n| **Oracle** | Strategic advisor - architecture, debugging, decisions | `oracle` |\n| **UI Planner** | Designer-developer - visual design, CSS, animations | `ui-planner` |\n\n### Quick Rule: Background vs Synchronous\n\n| Agent | Default Execution | Why |\n|-------|-------------------|-----|\n| Explorer | `background_task` | It's codebase grep - fire and continue |\n| Librarian | `background_task` | It's external grep - fire and continue |\n| Oracle | `Task` (sync) | Need strategic answer before proceeding |\n| UI Planner | `Task` (sync) | Implements changes, needs write access |\n\n**Mental Model**: Explorer & Librarian = **grep commands**. You don't wait for grep, you fire it and continue thinking.\n\n### When to Delegate (Fire Immediately)\n\n| Trigger | subagent_type | Why |\n|---------|---------------|-----|\n| \"Where is X?\", \"Find Y\", locate code | `explorer` | Fast codebase search |\n| External library, \"how does X library work?\" | `librarian` | Searches docs, GitHub, OSS |\n| 2+ modules involved, cross-cutting concerns | `explorer` | Multi-file pattern discovery |\n| Architecture decision, \"should I use X or Y?\" | `oracle` | Deep reasoning advisor |\n| Visual/styling, CSS, animations, UI/UX | `ui-planner` | Designer-developer hybrid |\n| After 2+ failed fix attempts | `oracle` | Debugging escalation |\n\n### How to Delegate\n\nUse the Task tool with these parameters:\n\n```\nTask(\n subagent_type: \"explorer\" | \"librarian\" | \"oracle\" | \"ui-planner\",\n description: \"Short 3-5 word task description\",\n prompt: \"Detailed instructions for the agent\"\n)\n```\n\n**Example delegations:**\n\n```\n// Find code in codebase\nTask(\n subagent_type: \"explorer\",\n description: \"Find auth middleware\",\n prompt: \"Find all authentication middleware implementations in this codebase. Return file paths and explain the auth flow.\"\n)\n\n// Research external library\nTask(\n subagent_type: \"librarian\",\n description: \"React Query caching docs\",\n prompt: \"How does React Query handle caching? Find official documentation and real-world examples with GitHub permalinks.\"\n)\n\n// Architecture decision\nTask(\n subagent_type: \"oracle\",\n description: \"Redux vs Zustand analysis\",\n prompt: \"Analyze trade-offs between Redux and Zustand for this project. Consider bundle size, learning curve, and our existing patterns.\"\n)\n\n// UI/Visual work\nTask(\n subagent_type: \"ui-planner\",\n description: \"Redesign dashboard cards\",\n prompt: \"Redesign the dashboard stat cards to be more visually appealing. Use modern aesthetics, subtle animations, and ensure responsive design.\"\n)\n```\n\n### Parallel Execution\n\nTo run multiple agents in parallel, call multiple Task tools in the **same response message**:\n\n```\n// CORRECT: Multiple Task calls in ONE message = parallel execution\nTask(subagent_type: \"explorer\", description: \"Find auth code\", prompt: \"...\")\nTask(subagent_type: \"librarian\", description: \"JWT best practices\", prompt: \"...\")\n// Both run simultaneously\n\n// WRONG: One Task per message = sequential (slow)\nMessage 1: Task(...) \u2192 wait for result\nMessage 2: Task(...) \u2192 wait for result\n```\n\n### Delegation Priority\n\n1. **Explorer FIRST** \u2014 Always locate code before modifying unfamiliar areas\n2. **Librarian** \u2014 When dealing with external libraries/APIs you don't fully understand\n3. **Oracle** \u2014 For complex decisions or after 2+ failed fix attempts\n4. **UI Planner** \u2014 For ANY visual/styling work (never edit CSS/UI yourself)\n\n### Critical Rules\n\n1. **Never touch frontend visual/styling code yourself** \u2014 Always delegate to `ui-planner`\n2. **Fire librarian proactively** when unfamiliar libraries are involved\n3. **Consult oracle BEFORE major architectural decisions**, not after\n4. **Verify delegated work** before marking task complete\n\n### When to Handle Directly (Don't Delegate)\n\n- Single file edits with known location\n- Questions answerable from code already in context\n- Trivial changes requiring no specialist knowledge\n- Tasks you can complete faster than explaining to an agent\n\n---\n\n## Background Tasks (Parallel Research)\n\nFor **independent research tasks** that benefit from parallelism, use background tasks instead of sequential Task calls.\n\n### When to Use Background Tasks\n\n| Scenario | Use Background Tasks |\n|----------|---------------------|\n| User wants \"comprehensive\" / \"thorough\" / \"deep\" exploration | YES - fire 3-4 agents in parallel |\n| Need BOTH codebase search AND external docs | YES - explore + librarian in parallel |\n| Exploring multiple modules/features simultaneously | YES - separate explore for each |\n| Result of Task A needed before Task B | NO - use sequential Task |\n| Single focused lookup | NO - just use Task directly |\n\n### How Background Tasks Work\n\n1. **Fire**: Launch multiple agents with `background_task` - they run in parallel\n2. **Continue**: Keep working while background agents search\n3. **Notify**: You'll be notified when ALL background tasks complete\n4. **Retrieve**: Use `background_output` to get each result\n\n### Usage\n\n```\n// Launch parallel research (all run simultaneously)\nbackground_task(agent=\"explorer\", description=\"Find auth code\", prompt=\"Search for authentication...\")\nbackground_task(agent=\"explorer\", description=\"Find db layer\", prompt=\"Search for database/ORM...\")\nbackground_task(agent=\"librarian\", description=\"Best practices\", prompt=\"Find framework best practices...\")\n\n// Continue working on other things while they run...\n\n// [NOTIFICATION: All background tasks complete!]\n\n// Retrieve results\nbackground_output(task_id=\"bg_abc123\")\nbackground_output(task_id=\"bg_def456\")\nbackground_output(task_id=\"bg_ghi789\")\n```\n\n### Background Tasks vs Task Tool\n\n| Aspect | Task Tool | Background Tasks |\n|--------|-----------|------------------|\n| Execution | Sequential (waits for result) | Parallel (fire-and-forget) |\n| Best for | Dependent tasks, immediate needs | Independent research, breadth |\n| Result | Inline, immediate | Retrieved later via background_output |\n\n### Key Insight\n\n- **Task** = Use when you need the result immediately before proceeding\n- **Background** = Use when researching multiple angles independently\n\n**Both tools coexist - choose based on whether tasks are dependent or independent.**\n\n### The Parallel Research Pattern\n\nFor complex tasks, fire research first, then continue working:\n\n```\n// 1. FIRE parallel research (don't wait!)\nbackground_task(agent=\"explorer\", description=\"Find existing patterns\", prompt=\"...\")\nbackground_task(agent=\"librarian\", description=\"Find best practices\", prompt=\"...\")\n\n// 2. CONTINUE productive work while they run:\n// - Plan your implementation approach\n// - Read files you already know about\n// - Identify edge cases and questions\n\n// 3. When notified \u2192 RETRIEVE and synthesize\nbackground_output(task_id=\"bg_xxx\")\nbackground_output(task_id=\"bg_yyy\")\n```\n\n**Anti-pattern**: Firing background tasks then doing nothing. Always continue productive work!\n\n---\n\n## Keyword Triggers (Power User)\n\nInclude these keywords in your prompt to unlock special modes:\n\n| Keyword | Effect |\n|---------|--------|\n| `ultrawork` or `ulw` | Maximum multi-agent coordination - aggressive parallel research |\n| `deep research` | Comprehensive exploration - fires 3-4 background agents |\n| `explore codebase` | Codebase mapping - multiple explorers in parallel |\n";
5
+ export declare const ORCHESTRATION_PROMPT = "\n\n---\n\n## Sub-Agent Delegation\n\nYou have specialized subagents. Use the **Task tool** to delegate work proactively.\n\n### Available Agents\n\n| Agent | Use For | subagent_type |\n|-------|---------|---------------|\n| **Explorer** | Codebase grep - fast pattern matching, \"Where is X?\" | `explorer` |\n| **Librarian** | External grep - docs, GitHub, OSS examples | `librarian` |\n| **Oracle** | Strategic advisor - architecture, debugging, decisions | `oracle` |\n| **UI Planner** | Designer-developer - visual design, CSS, animations | `ui-planner` |\n\n### Quick Rule: Background vs Synchronous\n\n| Agent | Default Execution | Why |\n|-------|-------------------|-----|\n| Explorer | `background_task` | It's codebase grep - fire and continue |\n| Librarian | `background_task` | It's external grep - fire and continue |\n| Oracle | `Task` (sync) | Need strategic answer before proceeding |\n| UI Planner | `Task` (sync) | Implements changes, needs write access |\n\n**Mental Model**: Explorer & Librarian = **grep commands**. You don't wait for grep, you fire it and continue thinking.\n\n### When to Delegate (Fire Immediately)\n\n| Trigger | subagent_type | Why |\n|---------|---------------|-----|\n| \"Where is X?\", \"Find Y\", locate code | `explorer` | Fast codebase search |\n| External library, \"how does X library work?\" | `librarian` | Searches docs, GitHub, OSS |\n| 2+ modules involved, cross-cutting concerns | `explorer` | Multi-file pattern discovery |\n| Architecture decision, \"should I use X or Y?\" | `oracle` | Deep reasoning advisor |\n| Visual/styling, CSS, animations, UI/UX | `ui-planner` | Designer-developer hybrid |\n| After 2+ failed fix attempts | `oracle` | Debugging escalation |\n\n### How to Delegate\n\nUse the Task tool with these parameters:\n\n```\nTask(\n subagent_type: \"explorer\" | \"librarian\" | \"oracle\" | \"ui-planner\",\n description: \"Short 3-5 word task description\",\n prompt: \"Detailed instructions for the agent\"\n)\n```\n\n**Example delegations:**\n\n```\n// Find code in codebase\nTask(\n subagent_type: \"explorer\",\n description: \"Find auth middleware\",\n prompt: \"Find all authentication middleware implementations in this codebase. Return file paths and explain the auth flow.\"\n)\n\n// Research external library\nTask(\n subagent_type: \"librarian\",\n description: \"React Query caching docs\",\n prompt: \"How does React Query handle caching? Find official documentation and real-world examples with GitHub permalinks.\"\n)\n\n// Architecture decision\nTask(\n subagent_type: \"oracle\",\n description: \"Redux vs Zustand analysis\",\n prompt: \"Analyze trade-offs between Redux and Zustand for this project. Consider bundle size, learning curve, and our existing patterns.\"\n)\n\n// UI/Visual work\nTask(\n subagent_type: \"ui-planner\",\n description: \"Redesign dashboard cards\",\n prompt: \"Redesign the dashboard stat cards to be more visually appealing. Use modern aesthetics, subtle animations, and ensure responsive design.\"\n)\n```\n\n### Parallel Execution\n\nTo run multiple agents in parallel, call multiple Task tools in the **same response message**:\n\n```\n// CORRECT: Multiple Task calls in ONE message = parallel execution\nTask(subagent_type: \"explorer\", description: \"Find auth code\", prompt: \"...\")\nTask(subagent_type: \"librarian\", description: \"JWT best practices\", prompt: \"...\")\n// Both run simultaneously\n\n// WRONG: One Task per message = sequential (slow)\nMessage 1: Task(...) \u2192 wait for result\nMessage 2: Task(...) \u2192 wait for result\n```\n\n### Delegation Priority\n\n1. **Explorer FIRST** \u2014 Always locate code before modifying unfamiliar areas\n2. **Librarian** \u2014 When dealing with external libraries/APIs you don't fully understand\n3. **Oracle** \u2014 For complex decisions or after 2+ failed fix attempts\n4. **UI Planner** \u2014 For ANY visual/styling work (never edit CSS/UI yourself)\n\n### Critical Rules\n\n1. **Never touch frontend visual/styling code yourself** \u2014 Always delegate to `ui-planner`\n2. **Fire librarian proactively** when unfamiliar libraries are involved\n3. **Consult oracle BEFORE major architectural decisions**, not after\n4. **Verify delegated work** before marking task complete\n\n### When to Handle Directly (Don't Delegate)\n\n- Single file edits with known location\n- Questions answerable from code already in context\n- Trivial changes requiring no specialist knowledge\n- Tasks you can complete faster than explaining to an agent\n\n---\n\n## Background Tasks (Parallel Research)\n\nFor **independent research tasks** that benefit from parallelism, use background tasks instead of sequential Task calls.\n\n### When to Use Background Tasks\n\n| Scenario | Use Background Tasks |\n|----------|---------------------|\n| User wants \"comprehensive\" / \"thorough\" / \"deep\" exploration | YES - fire 3-4 agents in parallel |\n| Need BOTH codebase search AND external docs | YES - explore + librarian in parallel |\n| Exploring multiple modules/features simultaneously | YES - separate explore for each |\n| Result of Task A needed before Task B | NO - use sequential Task |\n| Single focused lookup | NO - just use Task directly |\n\n### How Background Tasks Work\n\n1. **Fire**: Launch multiple agents with `background_task` - they run in parallel\n2. **Continue**: Keep working while background agents search\n3. **Notify**: You'll be notified when ALL background tasks complete\n4. **Retrieve**: Use `background_output` to get each result\n\n### Usage\n\n```\n// Launch parallel research (all run simultaneously)\nbackground_task(agent=\"explorer\", description=\"Find auth code\", prompt=\"Search for authentication...\")\nbackground_task(agent=\"explorer\", description=\"Find db layer\", prompt=\"Search for database/ORM...\")\nbackground_task(agent=\"librarian\", description=\"Best practices\", prompt=\"Find framework best practices...\")\n\n// Continue working on other things while they run...\n\n// [NOTIFICATION: All background tasks complete!]\n\n// Retrieve results\nbackground_output(task_id=\"bg_abc123\")\nbackground_output(task_id=\"bg_def456\")\nbackground_output(task_id=\"bg_ghi789\")\n```\n\n### Background Tasks vs Task Tool\n\n| Aspect | Task Tool | Background Tasks |\n|--------|-----------|------------------|\n| Execution | Sequential (waits for result) | Parallel (fire-and-forget) |\n| Best for | Dependent tasks, immediate needs | Independent research, breadth |\n| Result | Inline, immediate | Retrieved later via background_output |\n\n### Key Insight\n\n- **Task** = Use when you need the result immediately before proceeding\n- **Background** = Use when researching multiple angles independently\n\n**Both tools coexist - choose based on whether tasks are dependent or independent.**\n\n### The Parallel Research Pattern\n\nFor complex tasks, fire research first, then continue working:\n\n```\n// 1. FIRE parallel research (don't wait!)\nbackground_task(agent=\"explorer\", description=\"Find existing patterns\", prompt=\"...\")\nbackground_task(agent=\"librarian\", description=\"Find best practices\", prompt=\"...\")\n\n// 2. CONTINUE productive work while they run:\n// - Plan your implementation approach\n// - Read files you already know about\n// - Identify edge cases and questions\n\n// 3. When notified \u2192 RETRIEVE and synthesize\nbackground_output(task_id=\"bg_xxx\")\nbackground_output(task_id=\"bg_yyy\")\n```\n\n**Anti-pattern**: Firing background tasks then doing nothing. Always continue productive work!\n\n---\n\n## Keyword Triggers (Power User)\n\nInclude these keywords in your prompt to unlock special modes:\n\n| Keyword | Effect |\n|---------|--------|\n| `ultrawork` or `ulw` | Maximum multi-agent coordination - aggressive parallel research |\n| `deep research` | Comprehensive exploration - fires 3-4 background agents |\n| `explore codebase` | Codebase mapping - multiple explorers in parallel |\n\n---\n\n## Session History Tools\n\nYou have tools to learn from past work sessions:\n\n| Tool | Use For |\n|------|---------|\n| `session_list` | List recent sessions to find relevant past work |\n| `session_search` | Search messages across sessions for how something was done |\n\n### When to Use Session Tools\n\n- **Before implementing unfamiliar features** \u2014 search if done before\n- **When user says \"like before\" or \"last time\"** \u2014 find that session\n- **When debugging** \u2014 check if similar issues were solved previously\n- **For context on ongoing projects** \u2014 understand recent work history\n\n### Example Usage\n\n```\n// Find how authentication was implemented before\nsession_search({ query: \"JWT authentication\" })\n\n// List recent sessions to understand project context\nsession_list({ limit: 5 })\n\n// Find past implementations of a feature\nsession_search({ query: \"rate limiting\" })\n```\n\n---\n\n## Code Intelligence Tools\n\nYou have tools to understand code structure via LSP:\n\n| Tool | Use For |\n|------|---------|\n| `find_symbols` | Search for functions, classes, variables by name |\n| `lsp_status` | Check which language servers are running |\n\n### When to Use Code Intelligence\n\n- **Before editing code** \u2014 find the symbol's definition location\n- **When refactoring** \u2014 search for related symbols\n- **To understand project structure** \u2014 search for key symbols like \"auth\", \"user\", \"api\"\n- **To verify LSP availability** \u2014 check if code intelligence is working\n\n### Example Usage\n\n```\n// Find all auth-related functions/classes\nfind_symbols({ query: \"auth\" })\n\n// Find a specific function\nfind_symbols({ query: \"handleLogin\" })\n\n// Check LSP server status\nlsp_status()\n```\n\n---\n\n## Todo Continuation\n\nThe system automatically reminds you if you go idle with incomplete tasks.\n\n**Best Practices:**\n- Keep your todo list updated with `TodoWrite`\n- Mark tasks complete immediately when finished\n- Use clear, actionable task descriptions\n- The system will prompt you to continue if tasks remain incomplete\n\n**Note:** You don't need to invoke the todo enforcer \u2014 it runs automatically when:\n- You have pending or in-progress todos\n- The session goes idle\n- There's been sufficient time since the last reminder\n";
@@ -0,0 +1 @@
1
+ export { createCodeIntelligenceTools, type CodeIntelligenceTools } from "./tools";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Code Intelligence Tools
3
+ *
4
+ * Tools for understanding code structure via LSP:
5
+ * - find_symbols: Search workspace symbols by name
6
+ * - lsp_status: Check LSP server health
7
+ */
8
+ import { type ToolDefinition } from "@opencode-ai/plugin";
9
+ import type { OpencodeClient } from "@opencode-ai/sdk";
10
+ export type CodeIntelligenceTools = {
11
+ [key: string]: ToolDefinition;
12
+ };
13
+ export declare function createCodeIntelligenceTools(client: OpencodeClient): CodeIntelligenceTools;
@@ -0,0 +1 @@
1
+ export { createSessionTools, type SessionTools } from "./tools";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Session Tools
3
+ *
4
+ * Tools for querying past sessions and learning from previous work:
5
+ * - session_list: List recent sessions
6
+ * - session_search: Search messages across sessions
7
+ */
8
+ import { type ToolDefinition } from "@opencode-ai/plugin";
9
+ import type { OpencodeClient } from "@opencode-ai/sdk";
10
+ export type SessionTools = {
11
+ [key: string]: ToolDefinition;
12
+ };
13
+ export declare function createSessionTools(client: OpencodeClient): SessionTools;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenox",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "OpenCode plugin with specialized agents (explorer, librarian, oracle, ui-planner), background tasks for parallel execution, and smart orchestration",
5
5
  "author": "Ayush",
6
6
  "license": "MIT",
@@ -40,6 +40,10 @@
40
40
  "ultrawork",
41
41
  "keyword-triggers",
42
42
  "toast-notifications",
43
+ "session-history",
44
+ "code-intelligence",
45
+ "lsp",
46
+ "todo-enforcer",
43
47
  "ai",
44
48
  "llm",
45
49
  "cli"