diff --git a/crates/goose-mcp/src/computercontroller/mod.rs b/crates/goose-mcp/src/computercontroller/mod.rs index 2727c5e79d..205d19f65f 100644 --- a/crates/goose-mcp/src/computercontroller/mod.rs +++ b/crates/goose-mcp/src/computercontroller/mod.rs @@ -43,14 +43,15 @@ const OUTPUT_CHAR_CAP: usize = 50_000; /// Truncate output using head+tail strategy (40% head, 60% tail) if it exceeds `OUTPUT_CHAR_CAP`. /// This preserves the beginning and end of the output while omitting the middle. fn truncate_output(s: &str) -> String { - if s.len() <= OUTPUT_CHAR_CAP { + let total_chars = s.chars().count(); + if total_chars <= OUTPUT_CHAR_CAP { return s.to_string(); } - let head_len = OUTPUT_CHAR_CAP * 2 / 5; // 40% - let tail_len = OUTPUT_CHAR_CAP - head_len; // 60% - let head = &s[..head_len]; - let tail = &s[s.len() - tail_len..]; - let omitted = s.len() - head_len - tail_len; + let head_chars = OUTPUT_CHAR_CAP * 2 / 5; // 40% + let tail_chars = OUTPUT_CHAR_CAP - head_chars; // 60% + let omitted = total_chars - head_chars - tail_chars; + let head: String = s.chars().take(head_chars).collect(); + let tail: String = s.chars().skip(total_chars - tail_chars).collect(); format!( "{}\n\n... [truncated: {} characters omitted] ...\n\n{}", head, omitted, tail diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap index 4599aecffc..ec64e6a00d 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__all_platform_extensions.snap @@ -1,6 +1,5 @@ --- source: crates/goose/src/agents/prompt_manager.rs -assertion_line: 458 expression: system_prompt --- You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation). @@ -100,7 +99,24 @@ Manage agent sessions: list, view, start, send messages, and interrupt agents. You have these skills at your disposal, when it is clear they can help you solve a problem or you are asked to use them: +• agent-tools - Use when interacting with Block services — Slack, Google Drive, Google Calendar, Gmail, Snowflake, Jira, GitHub, Glean, Salesforce, Datadog, Linear, Airtable, PagerDuty, Sentry, Notion, Workday, Asana, and more. Always load this skill before accessing any Block service. +• check-ci - Use when checking, analyzing, investigating, debugging, triaging, polling, waiting for, rebuilding, or canary-building CI builds, build failures, or test failures. Fixes code and loops until CI is green via the ci-results.sqprod.co API. Works with both Kochiku and Buildkite. +• cloning-squareup-repos - Clone squareup repositories using the correct SSH remote. Use when cloning, downloading, fetching, pulling, checking out, or setting up any squareup/ GitHub repository. +• codesearch - Use when searching, finding, locating, discovering, querying, looking up, or browsing code patterns, files, or implementations across all Square repositories via go/codesearch. +• datadog - Use when investigating, debugging, querying, monitoring, checking, analyzing, searching, or reviewing production issues, service health, observability data, logs, metrics, traces, monitors, RUM sessions, CI pipelines, or frontend performance via Datadog. +• dev-guides - Use when looking up, searching, finding, reading, browsing, retrieving, querying, or checking internal developer documentation on dev-guides.sqprod.co. Load this skill when someone wants to search for docs, look up a guide, find a tutorial, read a page, browse documentation, retrieve markdown content from a dev-guides URL, or check internal engineering docs. +• eng-ai-chat - Searches internal company knowledge grounded in application context. Use when searching, querying, looking up, finding, asking, investigating, or retrieving company-specific information about apps, services, infrastructure, integrations, or platform guidance for Cash Cloud (CAKE) or SKI (Square). Retrieves and synthesizes information from multiple sources including AI-generated summaries, dev guides, code search results, Google Docs, and internal knowledge bases to provide comprehensive answers. +• gdrive - Interact with Google Drive, Docs, Sheets, and Slides. Use when searching, reading, writing, creating, uploading, downloading, exporting, sharing, organizing, or managing Google Drive files. Also use when inserting images into documents and presentations from local files (no public URLs needed), or when the user shares a URL from drive.google.com, docs.google.com, sheets.google.com, slides.google.com, or forms.google.com. +• glean - Use when searching, querying, looking up, finding, browsing, or discovering Block's internal knowledge base, wiki pages, policies, company information, or internal resources via Glean. Also use when querying Glean AI for answers or checking what documents exist on a topic. +• go-link - Use when translating, navigating, fetching, opening, resolving, looking up, or browsing internal go/ links (like go/benefits, go/oncall) to full URLs at https://go.sqprod.co/. • goose-doc-guide - Reference goose documentation to create, configure, or explain goose-specific features like recipes, extensions, sessions, and providers. You MUST fetch relevant goose docs before answering. You MUST NOT rely on training data or assumptions for any goose-specific fields, values, names, syntax, or commands. +• hermit - Use when installing, managing, listing, searching, upgrading, configuring, or troubleshooting developer tools and CLI binaries in a repository that uses Hermit for hermetic package management. Also use when agents attempt to install tools via brew, apt, npm, go install, pip, or other system package managers in a Hermit-managed repo, or when a required CLI tool is missing from the PATH. +• jira - Interact with Jira issue tracking using Atlassian CLI (ACLI). Use when listing, viewing, searching, creating, editing, updating, transitioning, commenting on, assigning, or managing Jira issues, tickets, stories, bugs, epics, or sprints. +• linear - Use when listing, searching, fetching, retrieving, downloading attachments or linked files from, creating, updating, assigning, commenting on, managing, filtering, or querying Linear issues, projects, labels, milestones, initiatives, and teams. +• protos - Use when searching, finding, looking up, querying, browsing, discovering, or inspecting protocol buffer definitions, proto messages, services, enums, or fields via the sq proto CLI. +• skill-management - Discover and manage AI agent skills via the sq-agents CLI. Use when you lack a skill for a task, want to check if a skill exists for a workflow, or need to find, install, update, upgrade, list, show, or remove skills. +• snowflake - Use when querying, searching, exploring, analyzing, looking up, checking, running SQL, inspecting tables, or examining data in Snowflake data warehouse. Connects via Okta SSO authentication. +• trust-feature-validation - Validate that a product feature is working correctly during rollout. Use when validating feature behavior during ramps, spot-checking affected users from Slack or escalations, running periodic audits, or investigating false positives and false negatives. Walks users through structured intake questions, queries Snowflake and other data sources, applies feature-specific validation logic, and outputs verdicts to terminal or Google Sheets. Supports pluggable initiative configs for any product area. ## summarize @@ -132,3 +148,22 @@ Template: # Response Guidelines Use Markdown formatting for all responses. + +# Knowledge Management + +When working with memory and skills extensions: + +## Memory +Save proactively — don't wait to be asked: +- User corrects you or says "remember this" → save immediately +- User shares a preference, habit, or personal detail → save to user_profile category +- You discover something about the environment → save to a relevant category +- Do NOT save: task progress, session outcomes, temporary state + +When memory is at capacity, curate: replace outdated entries, remove low-value ones. + +## Skills +After completing complex work (many tool calls, error recovery, or non-obvious workflows), +consider saving a reusable skill with create_skill. +If you loaded a skill and found it wrong or incomplete, patch it immediately with patch_skill. +Skills that aren't maintained become liabilities. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap index 03c0549415..e4b47232da 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__basic.snap @@ -16,3 +16,22 @@ No extensions are defined. You should let the user know that they should add ext # Response Guidelines Use Markdown formatting for all responses. + +# Knowledge Management + +When working with memory and skills extensions: + +## Memory +Save proactively — don't wait to be asked: +- User corrects you or says "remember this" → save immediately +- User shares a preference, habit, or personal detail → save to user_profile category +- You discover something about the environment → save to a relevant category +- Do NOT save: task progress, session outcomes, temporary state + +When memory is at capacity, curate: replace outdated entries, remove low-value ones. + +## Skills +After completing complex work (many tool calls, error recovery, or non-obvious workflows), +consider saving a reusable skill with create_skill. +If you loaded a skill and found it wrong or incomplete, patch it immediately with patch_skill. +Skills that aren't maintained become liabilities. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap index 306fd7dc7d..017e8353b8 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__one_extension.snap @@ -26,3 +26,22 @@ how to use this extension # Response Guidelines Use Markdown formatting for all responses. + +# Knowledge Management + +When working with memory and skills extensions: + +## Memory +Save proactively — don't wait to be asked: +- User corrects you or says "remember this" → save immediately +- User shares a preference, habit, or personal detail → save to user_profile category +- You discover something about the environment → save to a relevant category +- Do NOT save: task progress, session outcomes, temporary state + +When memory is at capacity, curate: replace outdated entries, remove low-value ones. + +## Skills +After completing complex work (many tool calls, error recovery, or non-obvious workflows), +consider saving a reusable skill with create_skill. +If you loaded a skill and found it wrong or incomplete, patch it immediately with patch_skill. +Skills that aren't maintained become liabilities. diff --git a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap index f26bbb8503..d52f350e8c 100644 --- a/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap +++ b/crates/goose/src/agents/snapshots/goose__agents__prompt_manager__tests__typical_setup.snap @@ -34,3 +34,22 @@ Consider asking if they'd like to disable some extensions to improve tool select # Response Guidelines Use Markdown formatting for all responses. + +# Knowledge Management + +When working with memory and skills extensions: + +## Memory +Save proactively — don't wait to be asked: +- User corrects you or says "remember this" → save immediately +- User shares a preference, habit, or personal detail → save to user_profile category +- You discover something about the environment → save to a relevant category +- Do NOT save: task progress, session outcomes, temporary state + +When memory is at capacity, curate: replace outdated entries, remove low-value ones. + +## Skills +After completing complex work (many tool calls, error recovery, or non-obvious workflows), +consider saving a reusable skill with create_skill. +If you loaded a skill and found it wrong or incomplete, patch it immediately with patch_skill. +Skills that aren't maintained become liabilities.