Skip to content

Commit fed4776

Browse files
thdxractions-userrekram1-node
authored
LLM cleanup (anomalyco#5462)
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
1 parent fdf560c commit fed4776

File tree

24 files changed

+548
-609
lines changed

24 files changed

+548
-609
lines changed

.opencode/opencode.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
"options": {},
1111
},
1212
},
13+
"mcp": {},
1314
}

packages/desktop/src/context/local.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
7878
})
7979

8080
const agent = (() => {
81-
const list = createMemo(() => sync.data.agent.filter((x) => x.mode !== "subagent"))
81+
const list = createMemo(() => sync.data.agent.filter((x) => x.mode !== "subagent" && !x.hidden))
8282
const [store, setStore] = createStore<{
8383
current: string
8484
}>({

packages/opencode/src/agent/agent.ts

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ import { Config } from "../config/config"
22
import z from "zod"
33
import { Provider } from "../provider/provider"
44
import { generateObject, type ModelMessage } from "ai"
5-
import PROMPT_GENERATE from "./generate.txt"
65
import { SystemPrompt } from "../session/system"
76
import { Instance } from "../project/instance"
87
import { mergeDeep } from "remeda"
98

9+
import PROMPT_GENERATE from "./generate.txt"
10+
import PROMPT_COMPACTION from "./prompt/compaction.txt"
11+
import PROMPT_EXPLORE from "./prompt/explore.txt"
12+
import PROMPT_SUMMARY from "./prompt/summary.txt"
13+
import PROMPT_TITLE from "./prompt/title.txt"
14+
1015
export namespace Agent {
1116
export const Info = z
1217
.object({
1318
name: z.string(),
1419
description: z.string().optional(),
1520
mode: z.enum(["subagent", "primary", "all"]),
16-
builtIn: z.boolean(),
21+
native: z.boolean().optional(),
22+
hidden: z.boolean().optional(),
1723
topP: z.number().optional(),
1824
temperature: z.number().optional(),
1925
color: z.string().optional(),
@@ -112,7 +118,8 @@ export namespace Agent {
112118
options: {},
113119
permission: agentPermission,
114120
mode: "subagent",
115-
builtIn: true,
121+
native: true,
122+
hidden: true,
116123
},
117124
explore: {
118125
name: "explore",
@@ -124,38 +131,51 @@ export namespace Agent {
124131
...defaultTools,
125132
},
126133
description: `Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.`,
127-
prompt: [
128-
`You are a file search specialist. You excel at thoroughly navigating and exploring codebases.`,
129-
``,
130-
`Your strengths:`,
131-
`- Rapidly finding files using glob patterns`,
132-
`- Searching code and text with powerful regex patterns`,
133-
`- Reading and analyzing file contents`,
134-
``,
135-
`Guidelines:`,
136-
`- Use Glob for broad file pattern matching`,
137-
`- Use Grep for searching file contents with regex`,
138-
`- Use Read when you know the specific file path you need to read`,
139-
`- Use Bash for file operations like copying, moving, or listing directory contents`,
140-
`- Adapt your search approach based on the thoroughness level specified by the caller`,
141-
`- Return file paths as absolute paths in your final response`,
142-
`- For clear communication, avoid using emojis`,
143-
`- Do not create any files, or run bash commands that modify the user's system state in any way`,
144-
``,
145-
`Complete the user's search request efficiently and report your findings clearly.`,
146-
].join("\n"),
134+
prompt: PROMPT_EXPLORE,
147135
options: {},
148136
permission: agentPermission,
149137
mode: "subagent",
150-
builtIn: true,
138+
native: true,
139+
},
140+
compaction: {
141+
name: "compaction",
142+
mode: "primary",
143+
native: true,
144+
hidden: true,
145+
prompt: PROMPT_COMPACTION,
146+
tools: {
147+
"*": false,
148+
},
149+
options: {},
150+
permission: agentPermission,
151151
},
152152
build: {
153153
name: "build",
154154
tools: { ...defaultTools },
155155
options: {},
156156
permission: agentPermission,
157157
mode: "primary",
158-
builtIn: true,
158+
native: true,
159+
},
160+
title: {
161+
name: "title",
162+
mode: "primary",
163+
options: {},
164+
native: true,
165+
hidden: true,
166+
permission: agentPermission,
167+
prompt: PROMPT_TITLE,
168+
tools: {},
169+
},
170+
summary: {
171+
name: "summary",
172+
mode: "primary",
173+
options: {},
174+
native: true,
175+
hidden: true,
176+
permission: agentPermission,
177+
prompt: PROMPT_SUMMARY,
178+
tools: {},
159179
},
160180
plan: {
161181
name: "plan",
@@ -165,7 +185,7 @@ export namespace Agent {
165185
...defaultTools,
166186
},
167187
mode: "primary",
168-
builtIn: true,
188+
native: true,
169189
},
170190
}
171191
for (const [key, value] of Object.entries(cfg.agent ?? {})) {
@@ -181,7 +201,7 @@ export namespace Agent {
181201
permission: agentPermission,
182202
options: {},
183203
tools: {},
184-
builtIn: false,
204+
native: false,
185205
}
186206
const {
187207
name,
File renamed without changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
2+
3+
Your strengths:
4+
- Rapidly finding files using glob patterns
5+
- Searching code and text with powerful regex patterns
6+
- Reading and analyzing file contents
7+
8+
Guidelines:
9+
- Use Glob for broad file pattern matching
10+
- Use Grep for searching file contents with regex
11+
- Use Read when you know the specific file path you need to read
12+
- Use Bash for file operations like copying, moving, or listing directory contents
13+
- Adapt your search approach based on the thoroughness level specified by the caller
14+
- Return file paths as absolute paths in your final response
15+
- For clear communication, avoid using emojis
16+
- Do not create any files, or run bash commands that modify the user's system state in any way
17+
18+
Complete the user's search request efficiently and report your findings clearly.
File renamed without changes.

packages/opencode/src/session/prompt/title.txt renamed to packages/opencode/src/agent/prompt/title.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Your output must be:
2222
- The title should NEVER include "summarizing" or "generating" when generating a title
2323
- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
2424
- Always output something meaningful, even if the input is minimal.
25-
- If the user message is short or conversational (e.g. hello”, “lol”, “whats up”, “hey):
26-
→ create a title that reflects the users tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
25+
- If the user message is short or conversational (e.g. "hello", "lol", "whats up", "hey"):
26+
→ create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
2727
</rules>
2828

2929
<examples>

packages/opencode/src/cli/cmd/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ const AgentListCommand = cmd({
227227
async fn() {
228228
const agents = await Agent.list()
229229
const sortedAgents = agents.sort((a, b) => {
230-
if (a.builtIn !== b.builtIn) {
231-
return a.builtIn ? -1 : 1
230+
if (a.native !== b.native) {
231+
return a.native ? -1 : 1
232232
}
233233
return a.name.localeCompare(b.name)
234234
})

packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function DialogAgent() {
1212
return {
1313
value: item.name,
1414
title: item.name,
15-
description: item.builtIn ? "native" : item.description,
15+
description: item.native ? "native" : item.description,
1616
}
1717
}),
1818
)

packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export function Autocomplete(props: {
184184
const agents = createMemo(() => {
185185
const agents = sync.data.agent
186186
return agents
187-
.filter((agent) => !agent.builtIn && agent.mode !== "primary")
187+
.filter((agent) => !agent.hidden && agent.mode !== "primary")
188188
.map(
189189
(agent): AutocompleteOption => ({
190190
display: "@" + agent.name,

0 commit comments

Comments
 (0)