mirror of
https://github.com/theniceboy/.config.git
synced 2026-05-11 17:36:05 +08:00
agent tracker update
This commit is contained in:
parent
0bfcb8d7c3
commit
ba2c8ef54e
2 changed files with 26 additions and 10 deletions
|
|
@ -7,7 +7,8 @@
|
||||||
## Work Summary
|
## Work Summary
|
||||||
|
|
||||||
- `set_work_summary` is mandatory protocol, not a suggestion.
|
- `set_work_summary` is mandatory protocol, not a suggestion.
|
||||||
- Call `set_work_summary` at least once at the start of every busy turn before any substantive tool call, code change, research step, or substantive user-facing response.
|
- It is fine to inspect first. You may use exploratory tools like search, read, task, web, or read-only shell commands before calling `set_work_summary`.
|
||||||
|
- Call `set_work_summary` once you have enough context to label the work accurately, and always before edits, patches, or other committed actions.
|
||||||
- Prefer calling it with both fields: `set_work_summary({ theme: "...", now: "..." })`.
|
- Prefer calling it with both fields: `set_work_summary({ theme: "...", now: "..." })`.
|
||||||
- `theme` answers: what is this pane about overall? Keep it stable across many turns.
|
- `theme` answers: what is this pane about overall? Keep it stable across many turns.
|
||||||
- `now` answers: what are you about to do next? Update it whenever the next concrete step changes.
|
- `now` answers: what are you about to do next? Update it whenever the next concrete step changes.
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,21 @@ type TurnState = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const states = new Map<string, TurnState>()
|
const states = new Map<string, TurnState>()
|
||||||
|
const exploratoryTools = new Set([
|
||||||
|
"bash",
|
||||||
|
"read",
|
||||||
|
"glob",
|
||||||
|
"grep",
|
||||||
|
"task",
|
||||||
|
"question",
|
||||||
|
"webfetch",
|
||||||
|
"web_google_search",
|
||||||
|
"web_website_fetch",
|
||||||
|
"web_website_search",
|
||||||
|
"web_website_outline",
|
||||||
|
"web_website_extract_section",
|
||||||
|
"web_website_extract_pricing",
|
||||||
|
])
|
||||||
|
|
||||||
function sessionState(sessionID: string) {
|
function sessionState(sessionID: string) {
|
||||||
let state = states.get(sessionID)
|
let state = states.get(sessionID)
|
||||||
|
|
@ -24,6 +39,10 @@ function eventSessionID(event: any) {
|
||||||
).trim()
|
).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isExploratoryTool(tool: string) {
|
||||||
|
return exploratoryTools.has(tool)
|
||||||
|
}
|
||||||
|
|
||||||
export const RequireWorkSummaryPlugin: Plugin = async () => {
|
export const RequireWorkSummaryPlugin: Plugin = async () => {
|
||||||
return {
|
return {
|
||||||
"chat.message": async (input: any) => {
|
"chat.message": async (input: any) => {
|
||||||
|
|
@ -34,14 +53,6 @@ export const RequireWorkSummaryPlugin: Plugin = async () => {
|
||||||
sessionState(sessionID).summaryCalled = false
|
sessionState(sessionID).summaryCalled = false
|
||||||
},
|
},
|
||||||
|
|
||||||
"command.execute.before": async (input: any) => {
|
|
||||||
const sessionID = String(input?.sessionID || "").trim()
|
|
||||||
if (!sessionID) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
sessionState(sessionID).summaryCalled = false
|
|
||||||
},
|
|
||||||
|
|
||||||
"tool.execute.before": async (input: any) => {
|
"tool.execute.before": async (input: any) => {
|
||||||
const sessionID = String(input?.sessionID || "").trim()
|
const sessionID = String(input?.sessionID || "").trim()
|
||||||
if (!sessionID) {
|
if (!sessionID) {
|
||||||
|
|
@ -58,9 +69,13 @@ export const RequireWorkSummaryPlugin: Plugin = async () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isExploratoryTool(tool)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!state.summaryCalled) {
|
if (!state.summaryCalled) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Call set_work_summary first with a specific theme and next-step now label before using other tools.",
|
"Exploration tools can run first, but call set_work_summary before edits or other committed actions.",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue