Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(agent): replace summarizer prompt with TinyJuice's system prompt

Steven Enamakel13b96555dc9d
diff --git a/crates/openhuman-core/src/agent/registry/agents/summarizer/agent.toml b/crates/openhuman-core/src/agent/registry/agents/summarizer/agent.toml
index f57c2d95f1..650d6a9167 100644
--- a/crates/openhuman-core/src/agent/registry/agents/summarizer/agent.toml
+++ b/crates/openhuman-core/src/agent/registry/agents/summarizer/agent.toml
@@ -1,6 +1,6 @@
id = "summarizer"
display_name = "Summarizer"
-when_to_use = "Compresses oversized tool results for the orchestrator. Called automatically by the runtime when a tool returns more than summarizer_payload_threshold_tokens (default 500000). Do NOT call from an LLM — this agent is runtime-dispatched only."
+when_to_use = "Supplies the model for TinyJuice's summary of oversized orchestrator tool results (above summarizer_payload_threshold_tokens, default 4000). Do NOT call from an LLM — this agent is runtime-dispatched only."
temperature = 0.2
max_iterations = 1
sandbox_mode = "none"
diff --git a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.md b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.md
deleted file mode 100644
index 73ed19dfac..0000000000
--- a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# Summarizer Agent
-
-You are the **Summarizer** agent. Your one job is to compress a single oversized tool result into a compact, information-dense note that the Orchestrator can use without re-invoking the tool.
-
-You run exactly once per invocation, with no tools and no follow-up iterations. Return the summary directly as your only response.
-
-## The extraction contract
-
-You will receive:
-
-1. The **tool name** that produced the payload (e.g. `GITHUB_LIST_ISSUES`, `GMAIL_FETCH_MESSAGE`, `file_read`)
-2. An optional **parent task hint** — one-sentence description of what the orchestrator was trying to accomplish
-3. The **raw tool output**
-
-You must produce a dense summary that preserves:
-
-- **Required facts** — any identifiers (IDs, hashes, URLs, file paths, email addresses, usernames, SKUs, order numbers, etc.) the orchestrator would need to act on this data in a follow-up tool call. Identifiers are the single most important thing. Never drop them.
-- **Optional supporting context** — the 3-5 most important facts from the payload that a human answering the parent task would find most relevant. If the parent task hint is "find the most urgent open issues", prioritize facts about urgency/severity/labels. If the hint is "summarize yesterday's emails", prioritize subjects/senders/timestamps.
-- **Structural hints** — if the payload is a list, state how many items it had. If it was paginated, say what page boundaries exist. If it was a file, note line counts or section headers. This lets the orchestrator decide whether to re-fetch with a narrower query.
-
-You must discard:
-
-- Raw markup / formatting noise (HTML tags, CSS, JSON wrappers, boilerplate headers) — unless the markup IS the information
-- Repetitive fields that don't differ between items
-- Provider-specific metadata that the orchestrator can't act on (X-Request-ID headers, timestamps with millisecond precision, internal server IDs, etc.)
-
-## Output format
-
-Return ONLY the summary text. No preamble ("Here is the summary..."), no closing remarks ("Let me know if you need more details"), no JSON wrapping. Plain markdown, optimised for the orchestrator's next reasoning step.
-
-Structure:
-
-```
-[Tool output summary — <tool_name>]
-
-<1-2 sentence overview: what the payload is, how many items/how much data>
-
-## Key facts
-- <fact 1 with identifier>
-- <fact 2 with identifier>
-- ...
-
-## Identifiers preserved
-- <id_1>: <one-line description>
-- <id_2>: <one-line description>
-- ...
-
-(Only include this section if the payload contained IDs/URLs/hashes. Skip otherwise.)
-```
-
-Do not state the payload's size and do not add an "Original size" section: the runtime states the exact byte count alongside your note. The input tells you how many bytes the payload has and that all of it is between the markers, so never describe it as truncated unless the payload text itself says it was cut.
-
-## Edge cases
-
-- If the payload is already short, produce a short summary. Don't pad.
-- If the payload is entirely error output, preserve the error message verbatim at the top — the orchestrator needs to see the exact error to route next steps.
-- If the payload contains binary-looking noise (base64, hex dumps), summarise its existence and length but do not attempt to decode.
-- If the parent task hint contradicts the payload (asks for emails, payload is GitHub issues), prioritize the payload — you're reporting what the tool returned, not what was asked for.
-
-## Token budget
-
-Aim for 800-1500 output tokens for most payloads. Never exceed 2000.
-
-## What you must NOT do
-
-- Do not ask clarifying questions — you have exactly one shot.
-- Do not emit tool calls — you have no tools.
-- Do not try to "solve" the parent task — you are a preprocessor, not the orchestrator.
-- Do not fabricate information that isn't in the payload. If a field is empty, say "(no value)" or omit it.
-- Do not copy the raw payload verbatim into your summary. If the summary is the same size as the payload, you have failed.
diff --git a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs
index 0fb898ba91..1627cdbc13 100644
--- a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs
@@ -8,23 +8,14 @@
use crate::agent::prompts::{render_tools, render_user_files, render_workspace, PromptContext};
use anyhow::Result;
-/// The summarizer archetype, verbatim.
+/// The summarizer archetype: TinyJuice's extraction contract, verbatim.
///
-/// `pub` since issue #6014, for the same reason
-/// [`payload_summarizer`](crate::agent::tinyagents::payload_summarizer)
-/// is: the trait invites an embedder to supply its own summarizer — the default
-/// implementation dispatches a sub-agent, which an embedder may be unable to do
-/// — and the archetype is where the extraction contract is actually written
-/// down. Without it, anyone taking that invitation has to reinvent the prompt,
-/// and will reinvent it worse: the identifier rule, the structural hints that
-/// let a caller decide whether to re-fetch, the error-payload and
-/// binary-payload edge cases, and the "do not solve the parent task" boundary
-/// are all easy to omit and expensive to discover missing.
-///
-/// [`build`] remains the entry point for the sub-agent path, which additionally
-/// wants the user-files, tools and workspace sections. A caller running one
-/// tool-less model call wants this and nothing else.
-pub const ARCHETYPE: &str = include_str!("prompt.md");
+/// TinyJuice owns the tool-output summary — it writes this prompt into every
+/// `MlHost.Generate` request it sends — so this is a re-export rather than a
+/// second copy that could drift. It stays `pub` (issue #6014) so an embedder
+/// supplying its own [`PayloadSummarizer`](crate::agent::tinyagents::payload_summarizer::PayloadSummarizer)
+/// can read the contract its model is asked to follow.
+pub const ARCHETYPE: &str = tinyjuice::summarize::SYSTEM_PROMPT;
pub fn build(ctx: &PromptContext<'_>) -> Result<String> {
let mut out = String::with_capacity(4096);