From a3de1ab4b4444abdcc66d71c288e56a369ee4425 Mon Sep 17 00:00:00 2001 From: GH05TCREW Date: Sat, 13 Dec 2025 08:40:02 -0700 Subject: [PATCH] feat(notes): truncate injected notes in system prompt to save tokens --- ghostcrew/agents/ghostcrew_agent/ghostcrew_agent.py | 5 +++++ ghostcrew/agents/prompts/ghost_agent.jinja | 1 + ghostcrew/agents/prompts/ghost_assist.jinja | 1 + 3 files changed, 7 insertions(+) diff --git a/ghostcrew/agents/ghostcrew_agent/ghostcrew_agent.py b/ghostcrew/agents/ghostcrew_agent/ghostcrew_agent.py index d8c3b56..10f69f9 100644 --- a/ghostcrew/agents/ghostcrew_agent/ghostcrew_agent.py +++ b/ghostcrew/agents/ghostcrew_agent/ghostcrew_agent.py @@ -82,6 +82,11 @@ class GhostCrewAgent(BaseAgent): cat = data.get("category", "info") content = data.get("content", "") + # Truncate long notes in system prompt to save tokens + # The agent can use the 'read' tool to get the full content + if len(content) > 200: + content = content[:197] + "..." + if cat not in grouped: grouped[cat] = [] grouped[cat].append(f"- {key}: {content}") diff --git a/ghostcrew/agents/prompts/ghost_agent.jinja b/ghostcrew/agents/prompts/ghost_agent.jinja index bd6b35f..1fc4146 100644 --- a/ghostcrew/agents/prompts/ghost_agent.jinja +++ b/ghostcrew/agents/prompts/ghost_agent.jinja @@ -60,5 +60,6 @@ Scope: {{ scope | join(', ') }} {% if notes_context %} ## Saved Notes (from previous tasks) +(Notes may be truncated. Use `notes(action='read', key='...')` to see full content if needed.) {{ notes_context }} {% endif %} diff --git a/ghostcrew/agents/prompts/ghost_assist.jinja b/ghostcrew/agents/prompts/ghost_assist.jinja index 9aa9be2..135fffa 100644 --- a/ghostcrew/agents/prompts/ghost_assist.jinja +++ b/ghostcrew/agents/prompts/ghost_assist.jinja @@ -44,5 +44,6 @@ Scope: {{ scope | join(', ') }} {% if notes_context %} ## Saved Notes (from previous tasks) +(Notes may be truncated. Use `notes(action='read', key='...')` to see full content if needed.) {{ notes_context }} {% endif %}