Skip to content
This repository was archived by the owner on Oct 9, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions plugins/summarize/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,44 @@ default = 3
[options.system_prompt]
type = "string"
title = "System prompt"
description = "The system instruction sent with every request; diffr builds each request's message from the file's numbered lines and the folds to summarize. Unset uses the default: https://github.com/devdotfast/diffr/blob/main/plugins/summarize/plugin.toml#L72-L78"
description = "The system instruction sent with every request; diffr builds each request's message from the file's numbered lines and the folds to summarize. Unset uses the default: https://github.com/devdotfast/diffr/blob/main/plugins/summarize/plugin.toml#L72-L108"
default = """\
For each listed fold, rewrite that function body as short \
pseudocode. Keep the names. No prose, no comments, no code fences. Use as few lines as \
possible: about one pseudocode line per five source lines, and never more than a third \
of the body's lines. When a fold lists a doc, also set "summary" to one sentence copied \
verbatim from that doc; otherwise leave it empty. Answer with a JSON object whose \
"summaries" array holds one {"id", "summary", "pseudocode"} object per fold."""
For each listed fold, rewrite that function or test body as pseudocode a reviewer can \
read instead of the code. First decide what the body mostly does, then use its shape.

Logic or an algorithm (branches, loops, computation): plain-word steps, nested two \
spaces per level:
if content is unchanged
return cached result
write new content
return fresh result

Control flow (mostly calls to other functions, in order): a call tree of the callees, \
each call's own calls indented under it:
createSession
persistPrompt
launchAgent
navigateToSession

UI (renders components or markup): a component tree, with the hooks and state that \
matter under their component, and a component's module in parentheses when it comes \
from elsewhere:
<SessionToolbar>
useSessionEvents()
<RunSkillButton> (packages/ui)

A test: the setup, the action under test, then what it asserts.

If uncertain, pick the option with the shortest output / explanation. You do not need to be 1:1 \
with the underlying code in any of this pseudocode. You can use notional function names, etc. \
as long as it helps the reader get a quick understanding of what the underlying code is doing.

Pseudocode is best read when it's short and sweet - you are not trying to write an algorithms textbook, \
just a quick summary that the user can expand to the underlying code. Strive to compress the code.

When a fold lists a doc, also set "summary" to one sentence copied verbatim from that \
doc; otherwise leave it empty. Answer with a JSON object whose "summaries" array holds \
one {"id", "summary", "pseudocode"} object per fold."""

[options.tests]
type = "boolean"
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,10 @@ mod tests {
let summarize = &plugins["bundled"]["properties"]["summarize"]["properties"];
// A text setting, so settings screens let users edit the prompt.
assert!(summarize["system_prompt"].get("x-settings").is_none());
assert!(summarize["system_prompt"]["default"]
.as_str()
.unwrap()
.starts_with("For each listed fold, rewrite that function body"));
assert_eq!(
summarize["system_prompt"]["default"],
super::builtin::manifest("summarize").unwrap().options["system_prompt"]["default"]
);
let keys: Vec<&String> = plugins.as_object().unwrap().keys().collect();
assert_eq!(keys, ["order", "bundled", "external"]);
}
Expand Down
4 changes: 0 additions & 4 deletions src/plugin/tests/summarize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,6 @@ fn the_system_prompt_is_the_configured_one() {
.fill_defaults(&mut defaults);
let default: Options = serde_json::from_value(serde_json::Value::Object(defaults)).unwrap();
assert_eq!(system, default.system_prompt.as_str());
assert!(default.system_prompt.starts_with(
"For each listed fold, rewrite that function body as short pseudocode. Keep the names."
));
assert!(!default.system_prompt.contains('\n'));
}

#[test]
Expand Down
Loading