pi-ui-extend 0.1.51 → 0.1.53
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/dist/bundled-extensions/question/tool-description.js +2 -3
- package/dist/tool-renderers/read.js +1 -1
- package/external/pi-tools-suite/src/async-subagents/core/agent-strategy.ts +6 -10
- package/external/pi-tools-suite/src/coding-discipline/index.ts +12 -22
- package/external/pi-tools-suite/src/dcp/prompts.ts +9 -49
- package/external/pi-tools-suite/src/tool-descriptions.ts +34 -61
- package/package.json +1 -1
|
@@ -4,8 +4,7 @@ export const QUESTION_TOOL_DESCRIPTION = {
|
|
|
4
4
|
description: "Ask the user one to five structured questions, each with two to five choices plus an implicit custom answer path.",
|
|
5
5
|
promptSnippet: "Gather structured user feedback with predefined choices and an always-available custom answer path.",
|
|
6
6
|
promptGuidelines: [
|
|
7
|
-
"Use question
|
|
8
|
-
"question accepts 1–5 questions
|
|
9
|
-
"Do not use question when the user's input is purely open-ended or when a normal conversational reply is clearer.",
|
|
7
|
+
"Use question to gather feedback, choose alternatives, confirm direction, or resolve ambiguity when you can provide at least two meaningful choices.",
|
|
8
|
+
"question accepts 1–5 questions with 2–5 choices each and an implicit custom answer path; avoid it for purely open-ended input or when normal conversation is clearer.",
|
|
10
9
|
],
|
|
11
10
|
};
|
|
@@ -2,7 +2,7 @@ import { isAbsolute, relative, sep } from "node:path";
|
|
|
2
2
|
import { syntaxHighlightLanguageForPath } from "../syntax-highlight.js";
|
|
3
3
|
import { numberArg, stringArg } from "./utils.js";
|
|
4
4
|
export const renderReadTool = (input) => {
|
|
5
|
-
const filePath = stringArg(input, ["path", "file", "target"]);
|
|
5
|
+
const filePath = stringArg(input, ["path", "file_path", "filePath", "file", "target"]);
|
|
6
6
|
if (!filePath)
|
|
7
7
|
return undefined;
|
|
8
8
|
const displayPath = pathForDisplay(filePath, input.cwd);
|
|
@@ -12,23 +12,19 @@ const FALSE_ENV_PATTERN = /^(0|false|off|no|disabled|none)$/i;
|
|
|
12
12
|
const TRUE_ENV_PATTERN = /^(1|true|on|yes|auto)$/i;
|
|
13
13
|
|
|
14
14
|
const PARALLEL_FIRST_STRATEGY_PROMPT = `<agent_strategy name="parallel-first">
|
|
15
|
-
|
|
15
|
+
Execution hint for Pi, not a replacement for system/developer/user instructions.
|
|
16
16
|
|
|
17
|
-
Default
|
|
17
|
+
Default for non-GPT models: orchestration-first. For broad, multi-file, ambiguous, review/audit, frontend, test-strategy, architecture, or root-cause work, prefer ultrawork mode: split independent tracks into focused async subagents, adding one oracle only for high-stakes uncertainty. Keep parent context lean, read compact results when needed, synthesize, then verify.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Do not over-delegate trivial work. For a simple question, one known file, exact lookup, typo, or narrow edit, solve directly with the cheapest suitable tool.
|
|
19
|
+
Do not over-delegate simple questions, known-file work, exact lookups, typos, or narrow edits; solve them directly with the cheapest suitable tool. If compressing unfinished work, preserve active objective + next step via todo/DCP rules.
|
|
22
20
|
</agent_strategy>`;
|
|
23
21
|
|
|
24
22
|
const DEEP_WORK_STRATEGY_PROMPT = `<agent_strategy name="deep-work">
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Default posture: autonomous deep worker. Build context directly, make concrete progress, edit and verify end-to-end. Use async subagents and ultrawork mode when the user asks for parallel/delegated work or when independent tracks will clearly reduce risk, but do not force orchestration onto narrow tasks.
|
|
23
|
+
Execution hint for Pi, not a replacement for system/developer/user instructions.
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
Default: autonomous deep worker. Build context directly, make progress, edit, and verify end-to-end. Use async subagents/ultrawork only when the user asks for delegation or independent tracks clearly reduce risk; do not force orchestration onto narrow tasks.
|
|
30
26
|
|
|
31
|
-
For broad work, keep delegation explicit and bounded:
|
|
27
|
+
For broad work, keep delegation explicit and bounded: focused review/research/tests/frontend/deep tracks, plus one oracle only for high-stakes uncertainty or final plan checks. Read compact results, decide in the parent session, and report only what matters. If compressing unfinished work, preserve active objective + next step via todo/DCP rules.
|
|
32
28
|
</agent_strategy>`;
|
|
33
29
|
|
|
34
30
|
export function agentStrategyPrompt(options: AgentStrategyOptions = {}): string | undefined {
|
|
@@ -61,26 +61,18 @@ const LOOKUP_TOOL_PARAMS = Type.Object(
|
|
|
61
61
|
const QUALITY_DISCIPLINE_LINES = [
|
|
62
62
|
"TOOL-ONLY CODING AGENT CONTRACT.",
|
|
63
63
|
"",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"",
|
|
67
|
-
"
|
|
68
|
-
"- The assistant message MUST be exactly one tool call with empty text.",
|
|
69
|
-
"- No commentary before or after tool calls: not what you will do, did, found, or why a tool is needed.",
|
|
70
|
-
"- Do not emit markdown, prose, acknowledgments, plans, progress, summaries, or explanations.",
|
|
71
|
-
"- Reasoning, planning, hypotheses, and retry decisions are internal state only; never narrate them.",
|
|
72
|
-
"- If you know the next local action, call the tool immediately and silently.",
|
|
64
|
+
"Follow this output-channel contract literally for coding tasks.",
|
|
65
|
+
"WORKING STATE: from the first assistant turn until complete, final, or blocked, emit exactly one tool call with empty text.",
|
|
66
|
+
"No prose, markdown, acknowledgments, plans, progress, summaries, explanations, or commentary before/after tool calls.",
|
|
67
|
+
"Keep reasoning, planning, hypotheses, and retry decisions internal; if a safe next local action exists, call the tool silently.",
|
|
73
68
|
"",
|
|
74
69
|
"After every tool result, choose exactly one transition:",
|
|
75
|
-
"-
|
|
76
|
-
"-
|
|
77
|
-
"-
|
|
78
|
-
"
|
|
79
|
-
"",
|
|
80
|
-
"FINAL: enter only after the work is complete or verified as far as practical; never merely to report progress.",
|
|
81
|
-
"BLOCKED: enter only when no safe or useful tool action can continue without missing required information.",
|
|
70
|
+
"- WORKING: exactly one next tool call with empty text;",
|
|
71
|
+
"- FINAL: one final answer after completion or practical verification;",
|
|
72
|
+
"- BLOCKED: one concise question only when no safe/useful tool action can continue.",
|
|
73
|
+
"No transition permits commentary between tool calls.",
|
|
82
74
|
"",
|
|
83
|
-
"PRIORITY:
|
|
75
|
+
"PRIORITY: this overrides default assistant friendliness and conversational behavior.",
|
|
84
76
|
"",
|
|
85
77
|
"Coding discipline (express only through tool choices, not prose):",
|
|
86
78
|
"- inspect before editing; do not invent APIs, files, commands, or behavior;",
|
|
@@ -103,11 +95,9 @@ const LOOKUP_DISCIPLINE_LINES = [
|
|
|
103
95
|
|
|
104
96
|
const FINAL_DISCIPLINE_LINES = [
|
|
105
97
|
"",
|
|
106
|
-
"When uncertain, test or inspect instead of assuming.",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"Report: what changed, what was verified, what was not verified, and any risks.",
|
|
110
|
-
"Ask at most one blocking question; otherwise proceed with grounded best effort.",
|
|
98
|
+
"When uncertain, test or inspect instead of assuming; otherwise proceed with grounded best effort.",
|
|
99
|
+
"Verify every non-trivial change. Never claim tests passed unless actually run.",
|
|
100
|
+
"Final report: what changed, what was verified, what was not verified, and any risks.",
|
|
111
101
|
];
|
|
112
102
|
|
|
113
103
|
const SILENCE_REMINDER_TEXT = [
|
|
@@ -9,63 +9,23 @@
|
|
|
9
9
|
* Appended to the existing system prompt when DCP is enabled (automatic mode).
|
|
10
10
|
*/
|
|
11
11
|
export const SYSTEM_PROMPT = `
|
|
12
|
-
You operate in a context-constrained environment.
|
|
12
|
+
You operate in a context-constrained environment. Keep live context high-signal; use \`compress\` only when it materially helps.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
\`compress\` is the ONLY context-management tool. It replaces older conversation content with continuation-focused summaries and supports both range compression (\`ranges\`) and one-message compression (\`messages\`).
|
|
15
15
|
|
|
16
|
-
\`mNNN\`/\`bN\`
|
|
17
|
-
|
|
18
|
-
THE PHILOSOPHY OF COMPRESS
|
|
19
|
-
\`compress\` transforms conversation content into dense, high-fidelity summaries. This is cleanup plus preservation: keep the state needed to continue, discard incidental transcript detail.
|
|
20
|
-
|
|
21
|
-
Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
|
|
22
|
-
|
|
23
|
-
OPERATING STANCE
|
|
24
|
-
Prefer short, closed, summary-safe compressions.
|
|
25
|
-
When multiple independent stale sections exist, prefer several focused compressions (in parallel when possible) over one broad compression.
|
|
26
|
-
When one older message is huge but the surrounding context is still useful, use message-mode compression for that single message instead of compressing a broad range.
|
|
27
|
-
Summaries should be proportional to future usefulness, not proportional to the amount of text being removed.
|
|
28
|
-
|
|
29
|
-
Use \`compress\` as context-pressure housekeeping, not as a reflex after every small step. When context usage is meaningfully high or a DCP reminder provides concrete candidates, compress closed slices before accumulating another large batch of tool output. At low context usage, continue normal work unless a closed slice is clearly large enough that keeping it raw would reduce signal.
|
|
30
|
-
|
|
31
|
-
A closed slice is any finished implementation, verification, config edit, answered exploration, dead-end debugging branch, or test/log inspection. Passing logs are summary-only: preserve command, pass/fail, key failures if any, and whether follow-up is needed; never keep a full passing log in live context. Treat large shell/read/repo/web outputs as disposable evidence once their facts are extracted.
|
|
32
|
-
|
|
33
|
-
Completed todo/task/subtask milestones are strong boundary signals, not automatic triggers. When context pressure makes compression useful, prefer the range covering a just-finished todo item if it is closed and non-trivial; do not compress merely because a todo was completed while context remains low.
|
|
34
|
-
|
|
35
|
-
Before compressing while work is unfinished, ensure one \`todo in_progress\` captures the active objective and next step.
|
|
36
|
-
|
|
37
|
-
When a \`<dcp-system-reminder>\` appears, treat it as a context-pressure signal. Follow critical/high-context reminders promptly. For routine reminders, compress only if a genuinely closed, useful-to-summarize slice exists; otherwise continue the next atomic step and re-check later.
|
|
38
|
-
|
|
39
|
-
CADENCE, SIGNALS, AND LATENCY
|
|
40
|
-
|
|
41
|
-
- Low context usage does not mandate compression
|
|
42
|
-
- Prioritize closedness and independence over raw size
|
|
43
|
-
- Prefer smaller, regular compressions over infrequent massive compressions for better latency and summary quality
|
|
44
|
-
- When multiple independent stale sections are ready, batch compressions in parallel
|
|
45
|
-
- Before large new exploration, ask whether an older completed slice can become summary-only; if yes and context pressure is meaningful, compress first
|
|
46
|
-
|
|
47
|
-
COMPRESS WHEN
|
|
48
|
-
|
|
49
|
-
A section is genuinely closed and the raw conversation has served its purpose:
|
|
16
|
+
\`mNNN\`/\`bN\` boundary IDs and \`<dcp-system-reminder>\` tags are environment-injected metadata. Do not output them.
|
|
50
17
|
|
|
51
|
-
-
|
|
52
|
-
- Implementation finished and verified
|
|
53
|
-
- Config/doc edit finished
|
|
54
|
-
- Test, lint, or CI output has been understood, especially passing logs
|
|
55
|
-
- Exploration exhausted and patterns understood
|
|
56
|
-
- Dead-end noise can be discarded without waiting for a whole chapter to close
|
|
18
|
+
Use compression for context-pressure housekeeping, not after every small step. Low context usage alone does not require compression. Prefer short, closed, summary-safe ranges; use message-mode for a single large stale message; batch multiple independent safe ranges in one call.
|
|
57
19
|
|
|
58
|
-
|
|
20
|
+
Good candidates: completed implementation, verification, config/doc edit, answered exploration, dead-end debugging, or understood test/lint/CI/log inspection. Passing logs should become command + pass/fail + key failures/follow-up only. Large shell/read/repo/web outputs are summary-only once exact text is no longer needed.
|
|
59
21
|
|
|
60
|
-
|
|
61
|
-
- The target content is still actively in progress
|
|
62
|
-
- You may need exact code, error messages, or file contents in the immediate next steps
|
|
22
|
+
Todo completions are useful boundary signals, not automatic triggers. Before compressing while work is unfinished, ensure one \`todo in_progress\` captures the active objective and next step.
|
|
63
23
|
|
|
64
|
-
|
|
24
|
+
Do not compress active work, still-needed raw context, or material whose exact code/error/output will be needed for immediate edits or references.
|
|
65
25
|
|
|
66
|
-
|
|
26
|
+
DCP reminders: handle critical/high-context reminders promptly and compress any safe high-yield closed slice before more exploration; routine reminders mean compress only if a safe, closed, useful slice exists, otherwise continue the next atomic step and re-check later.
|
|
67
27
|
|
|
68
|
-
|
|
28
|
+
Summaries must preserve only what is needed to continue: user intent and constraints, accepted decisions, files/symbols changed or inspected, actionable errors, verification status, and next steps. Drop incidental transcript detail, duplicate outputs, full logs, long code/JSON/diffs, and prose not needed later; include short literals only when required.
|
|
69
29
|
`.trim()
|
|
70
30
|
|
|
71
31
|
/**
|
|
@@ -29,9 +29,8 @@ export const COMPRESS_TOOL_DESCRIPTION: ToolDescription = {
|
|
|
29
29
|
description: COMPRESS_RANGE_DESCRIPTION,
|
|
30
30
|
promptSnippet: "Use compress for context-pressure housekeeping: summarize closed, high-yield stale slices when context is meaningfully high or a DCP reminder gives concrete candidates; do not compress just because low-context work produced a small closed slice.",
|
|
31
31
|
promptGuidelines: [
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"Keep active, still-needed context raw; compress only closed ranges whose exact content is unlikely to be needed next.",
|
|
32
|
+
"Compression candidates: completed implementation, verification, config/doc edits, answered exploration, dead ends, and log inspection when large/stale or context pressure is meaningful; Low context usage by itself does not require compression.",
|
|
33
|
+
"Summarize large stale shell/read/repo/web outputs, diffs, and passing logs once exact text is no longer useful; keep active or still-needed context raw.",
|
|
35
34
|
],
|
|
36
35
|
};
|
|
37
36
|
|
|
@@ -43,10 +42,8 @@ export function astGrepToolDescriptions(maxLines: number, maxBytesLabel: string)
|
|
|
43
42
|
description: `Read-only AST structural search/scan. Use for language-aware patterns, sgconfig/rule scans, JSON matches, and rewrite previews. Use text search for plain strings and ast_apply for mutations. Output truncates at ${maxLines} lines or ${maxBytesLabel} with full output saved to a temp file.`,
|
|
44
43
|
promptSnippet: "Use ast_grep for AST/structural code search, not plain text search. It previews rewrites only; use ast_apply to mutate files.",
|
|
45
44
|
promptGuidelines: [
|
|
46
|
-
"Use ast_grep when syntax/AST structure matters; use
|
|
47
|
-
"
|
|
48
|
-
"ast_grep is read-only: use rewrite to preview replacements, never to apply them.",
|
|
49
|
-
"Use ast_apply for intended ast-grep rewrites or scan fixes; use command=scan with rule, inlineRules, or config for rule-based scans.",
|
|
45
|
+
"Use ast_grep when syntax/AST structure matters; use text search for exact strings/regex. Keep paths/globs narrow and set lang for ambiguous snippets.",
|
|
46
|
+
"ast_grep is read-only: use rewrite to preview only; use ast_apply for mutations or command=scan fixes.",
|
|
50
47
|
],
|
|
51
48
|
},
|
|
52
49
|
astApply: {
|
|
@@ -55,9 +52,8 @@ export function astGrepToolDescriptions(maxLines: number, maxBytesLabel: string)
|
|
|
55
52
|
description: `Mutating AST rewrite/fix tool powered by ast-grep. Use for structural replacements or scan fixes after you know the pattern/rule is correct. Reports changedFiles for post-edit diagnostics and truncates output at ${maxLines} lines or ${maxBytesLabel}.`,
|
|
56
53
|
promptSnippet: "Use ast_apply only when you intend to mutate files with ast-grep structural rewrites or scan fixes.",
|
|
57
54
|
promptGuidelines: [
|
|
58
|
-
"Use ast_apply for AST-aware bulk edits, not simple one-off text replacements.",
|
|
59
|
-
"
|
|
60
|
-
"Run ast_grep first when the match set is uncertain; use ast_apply directly only for obvious, scoped rewrites.",
|
|
55
|
+
"Use ast_apply for AST-aware bulk edits, not simple one-off text replacements; preview with ast_grep when matches are uncertain.",
|
|
56
|
+
"Pattern rewrites: command=run with pattern/rewrite/lang; rule fixes: command=scan with rule, inlineRules, or config.",
|
|
61
57
|
],
|
|
62
58
|
},
|
|
63
59
|
} satisfies Record<string, ToolDescription>;
|
|
@@ -87,24 +83,18 @@ export function asyncSubagentToolDescriptions(options: ToolDescriptionSetOptions
|
|
|
87
83
|
? "For one semantic code-discovery question, use repo_search; for independent tracks/hypotheses/review axes, delegate even when repo_* tools exist. Read result only after completion when findings are needed."
|
|
88
84
|
: "For one focused code-discovery question, use direct read/grep. Without repo_* tools, spawn several focused scan/quick agents first for broad multi-track discovery, incident triage, release readiness, risk strategy, or parallel reviews. Read result only after completion when findings are needed."),
|
|
89
85
|
promptGuidelines: [
|
|
90
|
-
"Use action='spawn' only for LARGE
|
|
91
|
-
"Treat explicit requests to delegate, use sub-agents, run parallel agents, split into independent tracks, investigate hypotheses, or run separate review axes as spawn triggers; spawn first unless the request is trivial or clearly single-file.",
|
|
86
|
+
"Use action='spawn' only for LARGE/PARALLEL work: independent investigations, repo-wide sweeps, deep debugging, code review/audit, or explicit delegate/parallelize/split requests; these are spawn triggers unless trivial/single-file.",
|
|
92
87
|
repoDiscovery
|
|
93
|
-
? "For one discovery question, use repo_search; spawn
|
|
94
|
-
: "For one discovery question, use direct read/grep;
|
|
88
|
+
? "For one discovery question, use repo_search; spawn for independent tracks/hypotheses/review axes, and do not let repo_* availability suppress delegation."
|
|
89
|
+
: "For one discovery question, use direct read/grep; when repo_* tools are unavailable, spawn several focused scan/quick agents first for broad multi-file/module/hypothesis work.",
|
|
95
90
|
repoDiscovery
|
|
96
|
-
? "For incident triage, release readiness, or risk/test strategy with separate hypotheses
|
|
97
|
-
: "For incident triage, release readiness, or risk/test strategy with separate hypotheses
|
|
91
|
+
? "For incident triage, release readiness, or risk/test strategy with separate hypotheses/review tracks, prefer focused agents over serial parent-context work."
|
|
92
|
+
: "For incident triage, release readiness, or risk/test strategy with separate hypotheses/review tracks and no repo_* tools, call action='spawn' as the first discovery step; direct read/grep can follow.",
|
|
98
93
|
"Do not use subagents for exact-string lookups, known-file edits, typo/text replacements, obvious one-file changes, or interactive user input; use the cheapest direct path.",
|
|
99
|
-
"Spawn multiple focused agents in one action='spawn' call for independent questions; for
|
|
100
|
-
"For spawn, leave subagentType unset so the router chooses from configured roles. Set it only for user-named roles, deterministic tests, or another concrete override.",
|
|
101
|
-
"Use subagentType='oracle' sparingly for cross-provider second opinions on high-stakes uncertainty or final plan/risk checks.",
|
|
94
|
+
"Spawn multiple focused agents in one action='spawn' call for independent questions; for bounded probes set timeoutSeconds; omit subagentType unless user-named/deterministic, and use oracle sparingly for high-stakes uncertainty/final checks.",
|
|
102
95
|
"For screenshot/image inspection by blind models, use lookup; subagents only receive imagePaths when a broader delegated track genuinely needs them.",
|
|
103
|
-
"If
|
|
104
|
-
"Use
|
|
105
|
-
"Result output is compact with artifact links; inspect raw artifacts only when full details are necessary.",
|
|
106
|
-
"Use action='stop' when the user asks to stop, cancel, or kill running sub-agents.",
|
|
107
|
-
"Use action='cleanup' with delete=true after collecting all results to free disk space.",
|
|
96
|
+
"If asked to start/run/launch/test parallel sub-agents, spawn and stop; do not status/wait just for progress. Use status for recovery, wait only when needed/requested, result only after completion; compact results include artifact links.",
|
|
97
|
+
"Use action='stop' for stop/cancel/kill requests and action='cleanup' with delete=true only after collecting results.",
|
|
108
98
|
],
|
|
109
99
|
},
|
|
110
100
|
spawnAction: {
|
|
@@ -158,9 +148,8 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
158
148
|
description: "Indexed repo architecture map: entrypoints, module boundaries, cycles, and unresolved dependency classes. Use before broad reads in unfamiliar codebases; skip for exact-string lookups, known-file edits, or other trivial changes.",
|
|
159
149
|
promptSnippet: "Use repo_architecture for a compact indexed architecture overview before broad multi-file reads, not for simple literal searches or small known-scope edits.",
|
|
160
150
|
promptGuidelines: [
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"Use repo_structure for file/symbol listings and repo_search for behavior questions after this overview.",
|
|
151
|
+
"Exact strings, filenames, known symbols, typo/text replacements, or obvious one-file edits: skip repo_architecture and use direct text search/read/edit.",
|
|
152
|
+
"Broad unfamiliar codebase: make one narrow repo_architecture call first, add --path-prefix when a subsystem is known, then use repo_structure for files/symbols and repo_search for behavior.",
|
|
164
153
|
],
|
|
165
154
|
},
|
|
166
155
|
{
|
|
@@ -170,8 +159,7 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
170
159
|
description: "Indexed file tree and exported-symbol view for a directory/module. Use to choose files/ranges without dumping source.",
|
|
171
160
|
promptSnippet: "Use repo_structure for file trees, module contents, and exported symbols; narrow with idx flags.",
|
|
172
161
|
promptGuidelines: [
|
|
173
|
-
"Pass --path-prefix, --kind, --max-files, or --max-depth
|
|
174
|
-
"Use repo_ast for one large file's syntax map and repo_search for semantic behavior discovery.",
|
|
162
|
+
"Pass --path-prefix, --kind, --max-files, or --max-depth when useful; use repo_ast for one large file's syntax map and repo_search for semantic behavior discovery.",
|
|
175
163
|
],
|
|
176
164
|
},
|
|
177
165
|
{
|
|
@@ -181,8 +169,7 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
181
169
|
description: "Indexed AST map for one file. Use before repeated reads of a large file or when parent syntax structure matters.",
|
|
182
170
|
promptSnippet: "Use repo_ast with target=<file> to map one large file before choosing exact ranges to read.",
|
|
183
171
|
promptGuidelines: [
|
|
184
|
-
"Use
|
|
185
|
-
"Pass --max-depth or --max-nodes in args to keep the AST map compact.",
|
|
172
|
+
"Use for one known file, not repo-wide search; pass --max-depth or --max-nodes to keep output compact.",
|
|
186
173
|
],
|
|
187
174
|
targetDescription: "File path to map, e.g. src/api/client.ts.",
|
|
188
175
|
},
|
|
@@ -193,11 +180,9 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
193
180
|
description: "Indexed hybrid/semantic repository search for behavior questions when exact identifiers or files are unknown. Use natural-language behavior queries, not synonym dumps. Defaults to hybrid ranking; read returned ranges next.",
|
|
194
181
|
promptSnippet: "Use repo_search for conceptual codebase questions; query for behavior, not a bag of synonyms. Leave default hybrid ranking for first-pass searches and use Grep/read when exact names or positions are known.",
|
|
195
182
|
promptGuidelines: [
|
|
196
|
-
"Phrase target as
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"Use a specific conceptual target and narrow with --path-prefix, --max-files, --dedupe-file, or --exclude-tests when useful.",
|
|
200
|
-
"For bug/cause questions, stop when a read range shows the causal assignment/write/branch/call; continue only for a named gap such as callers, persistence, tests, or requested impact, and narrow follow-ups.",
|
|
183
|
+
"Phrase target as behavior, not synonym dumps; keep exact identifiers only as anchors. Prefer default hybrid first, using --mode semantic only when lexical/symbol terms mislead.",
|
|
184
|
+
"Make one targeted search, narrow with --path-prefix/--max-files/--dedupe-file/--exclude-tests when useful, read best ranges, then refine only for a named gap; avoid duplicate broad searches.",
|
|
185
|
+
"For bug/cause questions, stop when a read range shows the causal assignment/write/branch/call; continue only for named gaps such as callers, persistence, tests, or requested impact.",
|
|
201
186
|
],
|
|
202
187
|
targetDescription: "Natural-language behavior query, e.g. auth session token validation.",
|
|
203
188
|
},
|
|
@@ -208,8 +193,7 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
208
193
|
description: "Indexed explanation for a known symbol. Prefer file::symbol when the name may be ambiguous.",
|
|
209
194
|
promptSnippet: "Use repo_explain for a known symbol after you already know its name or file scope.",
|
|
210
195
|
promptGuidelines: [
|
|
211
|
-
"Prefer target=file::symbol for ambiguous names.",
|
|
212
|
-
"Use repo_search instead when you do not yet know the relevant symbol.",
|
|
196
|
+
"Prefer target=file::symbol for ambiguous names; use repo_search instead when the relevant symbol is still unknown.",
|
|
213
197
|
],
|
|
214
198
|
targetDescription: "Symbol or file-scoped symbol, e.g. createClient or src/api/client.ts::createClient.",
|
|
215
199
|
},
|
|
@@ -220,8 +204,7 @@ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
|
|
|
220
204
|
description: "Indexed dependency/caller tracing for a known path or symbol. Use for import impact and first-hop call/dependency analysis.",
|
|
221
205
|
promptSnippet: "Use repo_deps with target=<path|path::symbol> to trace imports, imported-by, callers, or callees.",
|
|
222
206
|
promptGuidelines: [
|
|
223
|
-
"
|
|
224
|
-
"Use repo_search first when you do not yet know the target path or symbol.",
|
|
207
|
+
"Use repo_search first when path/symbol is unknown. Otherwise start --depth 1; add --direction, --mode calls, or --show-edges only when needed.",
|
|
225
208
|
],
|
|
226
209
|
targetDescription: "Path or file-scoped symbol, e.g. src/api/client.ts or src/api/client.ts::createClient.",
|
|
227
210
|
},
|
|
@@ -237,18 +220,13 @@ export const TODO_TOOL_DESCRIPTION: ToolDescription = {
|
|
|
237
220
|
promptGuidelines: [
|
|
238
221
|
"Use `todo` for complex work with 3+ steps, explicit user task lists, or new non-trivial requirements. Skip single trivial tasks and purely conversational requests.",
|
|
239
222
|
"For multi-step implementation/debugging plans, include a final user-facing report todo in the initial plan with acceptance criteria for changed files/behavior, verification results, and remaining manual actions; close it immediately before the final response, never via compression.",
|
|
240
|
-
"Resync before continuing when
|
|
241
|
-
"Update todos when
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
247
|
-
"Use batch_create/batch_update for large explicit plans, but still keep exactly one visible task in_progress unless the user asks otherwise.",
|
|
248
|
-
"When starting a new plan that supersedes existing unfinished todos, use batch_create with replace:true instead of appending; only omit replace when intentionally extending the current plan.",
|
|
249
|
-
"list hides deleted tombstones unless includeDeleted:true; use status/blockedOnly filters only when needed. Use export/import for handoff or migration; import with replace:true only when explicitly overwriting todo state.",
|
|
250
|
-
"When every visible todo is completed, todo state clears automatically; do not call clear afterward just to remove completed tasks.",
|
|
251
|
-
"Persistence uses `/todos persist on|off|status` or `/todos-persist on|off|status`; when resuming, ask which ids are in scope and run `/todos scope <id...>` or `/todos-scope <id...>` so out-of-scope active tasks are deferred.",
|
|
223
|
+
"Resync before continuing when user/new findings change scope, requirements, safety, feasibility, approach, dependencies, or order; update tasks/blockers and defer obsolete work.",
|
|
224
|
+
"Update todos when starting, finishing, blocking, splitting, abandoning, or materially changing a step; before planned work mark exactly one in_progress with activeForm and complete it only after verification.",
|
|
225
|
+
"If partial, tests fail, or blocked, keep the task in_progress and add/update a blocker. Never use `clear`, `delete`, or batch deletion to hide unfinished/stale/forgotten todos; delete only on explicit request or creation mistake.",
|
|
226
|
+
"Before a final response after using todos, ensure each visible todo is completed, deferred, or intentionally still in_progress with explanation; do not leave a just-finished item in_progress.",
|
|
227
|
+
"Keep subjects short; use parentId/blockers for hierarchy/dependencies. For large explicit plans use batch_create/batch_update but keep exactly one visible in_progress unless asked otherwise; use batch_create replace:true only for superseding plans.",
|
|
228
|
+
"list hides tombstones unless includeDeleted:true; use status/blockedOnly only when needed; export/import for handoff, import replace:true only when explicitly overwriting; when all visible todos complete, state clears automatically.",
|
|
229
|
+
"Persistence: `/todos persist on|off|status` or `/todos-persist on|off|status`; on resume, ask in-scope ids and run `/todos scope <id...>` or `/todos-scope <id...>` so out-of-scope active tasks are deferred.",
|
|
252
230
|
],
|
|
253
231
|
};
|
|
254
232
|
|
|
@@ -258,8 +236,7 @@ export const SESSION_NAME_TOOL_DESCRIPTION: ToolDescription = {
|
|
|
258
236
|
description: "Show or set the current session name so the agent can retitle the active session without relying on slash-command parsing.",
|
|
259
237
|
promptSnippet: "Use session_name to rename the current session directly when the task calls for updating the session title.",
|
|
260
238
|
promptGuidelines: [
|
|
261
|
-
"Pass a short, user-meaningful name
|
|
262
|
-
"Call without a name only when you need to read the current session name.",
|
|
239
|
+
"Pass a short, user-meaningful name to rename; call without a name only to read the current session name.",
|
|
263
240
|
],
|
|
264
241
|
};
|
|
265
242
|
|
|
@@ -271,10 +248,8 @@ export const WEB_SEARCH_TOOL_DESCRIPTIONS = {
|
|
|
271
248
|
"Search the web for real-time information using your local Ollama instance's web_search API. Requires Ollama running locally with web search enabled; supports per-call timeout_ms and PI_WEB_SEARCH_TIMEOUT_MS.",
|
|
272
249
|
promptSnippet: "Search the web for current or real-time information through the local Ollama web_search API.",
|
|
273
250
|
promptGuidelines: [
|
|
274
|
-
"Use web_search
|
|
275
|
-
"
|
|
276
|
-
"Do not include secrets, tokens, or private repository data in web_search queries.",
|
|
277
|
-
"Do not use web_search for repository-local code discovery; use repo_* or file/search tools instead.",
|
|
251
|
+
"Use web_search only for current public web information; keep queries focused and set max_results only when useful.",
|
|
252
|
+
"Never include secrets, tokens, or private repository data; do not use web_search for repo-local discovery—use repo_* or file/search tools.",
|
|
278
253
|
],
|
|
279
254
|
},
|
|
280
255
|
webFetch: {
|
|
@@ -284,9 +259,7 @@ export const WEB_SEARCH_TOOL_DESCRIPTIONS = {
|
|
|
284
259
|
"Fetch and extract text content from a web page URL using your local Ollama instance's web_fetch API. Requires Ollama running locally with web fetch enabled; supports per-call timeout_ms and PI_WEB_SEARCH_TIMEOUT_MS.",
|
|
285
260
|
promptSnippet: "Fetch and extract text from a specific URL through the local Ollama web_fetch API.",
|
|
286
261
|
promptGuidelines: [
|
|
287
|
-
"Use web_fetch
|
|
288
|
-
"Do not pass URLs containing secrets or private credentials to web_fetch.",
|
|
289
|
-
"Do not use web_fetch as a generic repository file reader; use read for local files.",
|
|
262
|
+
"Use web_fetch for user-provided URLs or web_search results needing deeper reading; never pass secret/private-credential URLs, and use read for local files.",
|
|
290
263
|
],
|
|
291
264
|
},
|
|
292
265
|
} satisfies Record<string, ToolDescription>;
|