shotgun-sh 0.2.17__py3-none-any.whl → 0.4.0.dev1__py3-none-any.whl
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.
- shotgun/agents/agent_manager.py +219 -37
- shotgun/agents/common.py +79 -78
- shotgun/agents/config/README.md +89 -0
- shotgun/agents/config/__init__.py +10 -1
- shotgun/agents/config/manager.py +364 -53
- shotgun/agents/config/models.py +101 -21
- shotgun/agents/config/provider.py +51 -13
- shotgun/agents/config/streaming_test.py +119 -0
- shotgun/agents/context_analyzer/analyzer.py +6 -2
- shotgun/agents/conversation/__init__.py +18 -0
- shotgun/agents/conversation/filters.py +164 -0
- shotgun/agents/conversation/history/chunking.py +278 -0
- shotgun/agents/{history → conversation/history}/compaction.py +27 -1
- shotgun/agents/{history → conversation/history}/constants.py +5 -0
- shotgun/agents/conversation/history/file_content_deduplication.py +239 -0
- shotgun/agents/{history → conversation/history}/history_processors.py +267 -3
- shotgun/agents/{history → conversation/history}/token_counting/anthropic.py +8 -0
- shotgun/agents/{conversation_manager.py → conversation/manager.py} +1 -1
- shotgun/agents/{conversation_history.py → conversation/models.py} +8 -94
- shotgun/agents/error/__init__.py +11 -0
- shotgun/agents/error/models.py +19 -0
- shotgun/agents/export.py +12 -13
- shotgun/agents/models.py +66 -1
- shotgun/agents/plan.py +12 -13
- shotgun/agents/research.py +13 -10
- shotgun/agents/router/__init__.py +47 -0
- shotgun/agents/router/models.py +376 -0
- shotgun/agents/router/router.py +185 -0
- shotgun/agents/router/tools/__init__.py +18 -0
- shotgun/agents/router/tools/delegation_tools.py +503 -0
- shotgun/agents/router/tools/plan_tools.py +322 -0
- shotgun/agents/runner.py +230 -0
- shotgun/agents/specify.py +12 -13
- shotgun/agents/tasks.py +12 -13
- shotgun/agents/tools/file_management.py +49 -1
- shotgun/agents/tools/registry.py +2 -0
- shotgun/agents/tools/web_search/__init__.py +1 -2
- shotgun/agents/tools/web_search/gemini.py +1 -3
- shotgun/agents/tools/web_search/openai.py +1 -1
- shotgun/build_constants.py +2 -2
- shotgun/cli/clear.py +1 -1
- shotgun/cli/compact.py +5 -3
- shotgun/cli/context.py +44 -1
- shotgun/cli/error_handler.py +24 -0
- shotgun/cli/export.py +34 -34
- shotgun/cli/plan.py +34 -34
- shotgun/cli/research.py +17 -9
- shotgun/cli/spec/__init__.py +5 -0
- shotgun/cli/spec/backup.py +81 -0
- shotgun/cli/spec/commands.py +132 -0
- shotgun/cli/spec/models.py +48 -0
- shotgun/cli/spec/pull_service.py +219 -0
- shotgun/cli/specify.py +20 -19
- shotgun/cli/tasks.py +34 -34
- shotgun/codebase/core/change_detector.py +1 -1
- shotgun/codebase/core/ingestor.py +154 -8
- shotgun/codebase/core/manager.py +1 -1
- shotgun/codebase/models.py +2 -0
- shotgun/exceptions.py +325 -0
- shotgun/llm_proxy/__init__.py +17 -0
- shotgun/llm_proxy/client.py +215 -0
- shotgun/llm_proxy/models.py +137 -0
- shotgun/logging_config.py +42 -0
- shotgun/main.py +4 -0
- shotgun/posthog_telemetry.py +1 -1
- shotgun/prompts/agents/export.j2 +2 -0
- shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +23 -3
- shotgun/prompts/agents/partials/interactive_mode.j2 +3 -3
- shotgun/prompts/agents/partials/router_delegation_mode.j2 +36 -0
- shotgun/prompts/agents/plan.j2 +29 -1
- shotgun/prompts/agents/research.j2 +75 -23
- shotgun/prompts/agents/router.j2 +440 -0
- shotgun/prompts/agents/specify.j2 +80 -4
- shotgun/prompts/agents/state/system_state.j2 +15 -8
- shotgun/prompts/agents/tasks.j2 +63 -23
- shotgun/prompts/history/chunk_summarization.j2 +34 -0
- shotgun/prompts/history/combine_summaries.j2 +53 -0
- shotgun/sdk/codebase.py +14 -3
- shotgun/settings.py +5 -0
- shotgun/shotgun_web/__init__.py +67 -1
- shotgun/shotgun_web/client.py +42 -1
- shotgun/shotgun_web/constants.py +46 -0
- shotgun/shotgun_web/exceptions.py +29 -0
- shotgun/shotgun_web/models.py +390 -0
- shotgun/shotgun_web/shared_specs/__init__.py +32 -0
- shotgun/shotgun_web/shared_specs/file_scanner.py +175 -0
- shotgun/shotgun_web/shared_specs/hasher.py +83 -0
- shotgun/shotgun_web/shared_specs/models.py +71 -0
- shotgun/shotgun_web/shared_specs/upload_pipeline.py +329 -0
- shotgun/shotgun_web/shared_specs/utils.py +34 -0
- shotgun/shotgun_web/specs_client.py +703 -0
- shotgun/shotgun_web/supabase_client.py +31 -0
- shotgun/tui/app.py +78 -15
- shotgun/tui/components/mode_indicator.py +120 -25
- shotgun/tui/components/status_bar.py +2 -2
- shotgun/tui/containers.py +1 -1
- shotgun/tui/dependencies.py +64 -9
- shotgun/tui/layout.py +5 -0
- shotgun/tui/protocols.py +37 -0
- shotgun/tui/screens/chat/chat.tcss +9 -1
- shotgun/tui/screens/chat/chat_screen.py +1015 -106
- shotgun/tui/screens/chat/codebase_index_prompt_screen.py +196 -17
- shotgun/tui/screens/chat_screen/command_providers.py +13 -89
- shotgun/tui/screens/chat_screen/hint_message.py +76 -1
- shotgun/tui/screens/chat_screen/history/agent_response.py +7 -3
- shotgun/tui/screens/chat_screen/history/chat_history.py +12 -0
- shotgun/tui/screens/chat_screen/history/formatters.py +53 -15
- shotgun/tui/screens/chat_screen/history/partial_response.py +11 -1
- shotgun/tui/screens/chat_screen/messages.py +219 -0
- shotgun/tui/screens/confirmation_dialog.py +40 -0
- shotgun/tui/screens/directory_setup.py +45 -41
- shotgun/tui/screens/feedback.py +10 -3
- shotgun/tui/screens/github_issue.py +11 -2
- shotgun/tui/screens/model_picker.py +28 -8
- shotgun/tui/screens/onboarding.py +179 -26
- shotgun/tui/screens/pipx_migration.py +58 -6
- shotgun/tui/screens/provider_config.py +66 -8
- shotgun/tui/screens/shared_specs/__init__.py +21 -0
- shotgun/tui/screens/shared_specs/create_spec_dialog.py +273 -0
- shotgun/tui/screens/shared_specs/models.py +56 -0
- shotgun/tui/screens/shared_specs/share_specs_dialog.py +390 -0
- shotgun/tui/screens/shared_specs/upload_progress_screen.py +452 -0
- shotgun/tui/screens/shotgun_auth.py +110 -16
- shotgun/tui/screens/spec_pull.py +288 -0
- shotgun/tui/screens/welcome.py +123 -0
- shotgun/tui/services/conversation_service.py +5 -2
- shotgun/tui/utils/mode_progress.py +20 -86
- shotgun/tui/widgets/__init__.py +2 -1
- shotgun/tui/widgets/approval_widget.py +152 -0
- shotgun/tui/widgets/cascade_confirmation_widget.py +203 -0
- shotgun/tui/widgets/plan_panel.py +129 -0
- shotgun/tui/widgets/step_checkpoint_widget.py +180 -0
- shotgun/tui/widgets/widget_coordinator.py +1 -1
- {shotgun_sh-0.2.17.dist-info → shotgun_sh-0.4.0.dev1.dist-info}/METADATA +11 -4
- shotgun_sh-0.4.0.dev1.dist-info/RECORD +242 -0
- {shotgun_sh-0.2.17.dist-info → shotgun_sh-0.4.0.dev1.dist-info}/WHEEL +1 -1
- shotgun_sh-0.2.17.dist-info/RECORD +0 -194
- /shotgun/agents/{history → conversation/history}/__init__.py +0 -0
- /shotgun/agents/{history → conversation/history}/context_extraction.py +0 -0
- /shotgun/agents/{history → conversation/history}/history_building.py +0 -0
- /shotgun/agents/{history → conversation/history}/message_utils.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/__init__.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/base.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/openai.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/sentencepiece_counter.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/tokenizer_cache.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_counting/utils.py +0 -0
- /shotgun/agents/{history → conversation/history}/token_estimation.py +0 -0
- {shotgun_sh-0.2.17.dist-info → shotgun_sh-0.4.0.dev1.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.2.17.dist-info → shotgun_sh-0.4.0.dev1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""Pydantic models for LiteLLM Proxy API."""
|
|
2
|
+
|
|
3
|
+
from enum import StrEnum
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BudgetSource(StrEnum):
|
|
9
|
+
"""Source of budget information."""
|
|
10
|
+
|
|
11
|
+
KEY = "key"
|
|
12
|
+
TEAM = "team"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class KeyInfoData(BaseModel):
|
|
16
|
+
"""Key information data from /key/info endpoint."""
|
|
17
|
+
|
|
18
|
+
key_name: str = Field(description="Key name/identifier")
|
|
19
|
+
key_alias: str | None = Field(default=None, description="Human-readable key alias")
|
|
20
|
+
spend: float = Field(description="Current spend for this key in USD")
|
|
21
|
+
max_budget: float | None = Field(
|
|
22
|
+
default=None, description="Maximum budget for this key in USD"
|
|
23
|
+
)
|
|
24
|
+
team_id: str = Field(description="Team ID associated with this key")
|
|
25
|
+
user_id: str = Field(description="User ID associated with this key")
|
|
26
|
+
models: list[str] = Field(
|
|
27
|
+
default_factory=list, description="List of models available to this key"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class KeyInfoResponse(BaseModel):
|
|
32
|
+
"""Response from /key/info endpoint."""
|
|
33
|
+
|
|
34
|
+
key: str = Field(description="The API key")
|
|
35
|
+
info: KeyInfoData = Field(description="Key information data")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TeamInfoData(BaseModel):
|
|
39
|
+
"""Team information data from /team/info endpoint."""
|
|
40
|
+
|
|
41
|
+
team_id: str = Field(description="Team identifier")
|
|
42
|
+
team_alias: str | None = Field(
|
|
43
|
+
default=None, description="Human-readable team alias"
|
|
44
|
+
)
|
|
45
|
+
max_budget: float | None = Field(
|
|
46
|
+
default=None, description="Maximum budget for this team in USD"
|
|
47
|
+
)
|
|
48
|
+
spend: float = Field(description="Current spend for this team in USD")
|
|
49
|
+
models: list[str] = Field(
|
|
50
|
+
default_factory=list, description="List of models available to this team"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TeamInfoResponse(BaseModel):
|
|
55
|
+
"""Response from /team/info endpoint."""
|
|
56
|
+
|
|
57
|
+
team_id: str = Field(description="Team identifier")
|
|
58
|
+
team_info: TeamInfoData = Field(description="Team information data")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class BudgetInfo(BaseModel):
|
|
62
|
+
"""Unified budget information.
|
|
63
|
+
|
|
64
|
+
Combines key and team budget information to provide a single view
|
|
65
|
+
of budget status. Budget can come from either key-level or team-level,
|
|
66
|
+
with key-level taking priority if set.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
max_budget: float = Field(description="Maximum budget in USD")
|
|
70
|
+
spend: float = Field(description="Current spend in USD")
|
|
71
|
+
remaining: float = Field(description="Remaining budget in USD")
|
|
72
|
+
source: BudgetSource = Field(
|
|
73
|
+
description="Source of budget information (key or team)"
|
|
74
|
+
)
|
|
75
|
+
percentage_used: float = Field(description="Percentage of budget used (0-100)")
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_key_info(cls, key_info: KeyInfoData) -> "BudgetInfo":
|
|
79
|
+
"""Create BudgetInfo from key-level budget.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
key_info: Key information containing budget data
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
BudgetInfo instance with key-level budget
|
|
86
|
+
|
|
87
|
+
Raises:
|
|
88
|
+
ValueError: If key does not have max_budget set
|
|
89
|
+
"""
|
|
90
|
+
if key_info.max_budget is None:
|
|
91
|
+
raise ValueError("Key does not have max_budget set")
|
|
92
|
+
|
|
93
|
+
remaining = key_info.max_budget - key_info.spend
|
|
94
|
+
percentage_used = (
|
|
95
|
+
(key_info.spend / key_info.max_budget * 100)
|
|
96
|
+
if key_info.max_budget > 0
|
|
97
|
+
else 0.0
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return cls(
|
|
101
|
+
max_budget=key_info.max_budget,
|
|
102
|
+
spend=key_info.spend,
|
|
103
|
+
remaining=remaining,
|
|
104
|
+
source=BudgetSource.KEY,
|
|
105
|
+
percentage_used=percentage_used,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
@classmethod
|
|
109
|
+
def from_team_info(cls, team_info: TeamInfoData) -> "BudgetInfo":
|
|
110
|
+
"""Create BudgetInfo from team-level budget.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
team_info: Team information containing budget data
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
BudgetInfo instance with team-level budget
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
ValueError: If team does not have max_budget set
|
|
120
|
+
"""
|
|
121
|
+
if team_info.max_budget is None:
|
|
122
|
+
raise ValueError("Team does not have max_budget set")
|
|
123
|
+
|
|
124
|
+
remaining = team_info.max_budget - team_info.spend
|
|
125
|
+
percentage_used = (
|
|
126
|
+
(team_info.spend / team_info.max_budget * 100)
|
|
127
|
+
if team_info.max_budget > 0
|
|
128
|
+
else 0.0
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return cls(
|
|
132
|
+
max_budget=team_info.max_budget,
|
|
133
|
+
spend=team_info.spend,
|
|
134
|
+
remaining=remaining,
|
|
135
|
+
source=BudgetSource.TEAM,
|
|
136
|
+
percentage_used=percentage_used,
|
|
137
|
+
)
|
shotgun/logging_config.py
CHANGED
|
@@ -27,6 +27,44 @@ def get_log_directory() -> Path:
|
|
|
27
27
|
return log_dir
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def cleanup_old_log_files(log_dir: Path, max_files: int) -> None:
|
|
31
|
+
"""Remove old log files, keeping only the most recent ones.
|
|
32
|
+
|
|
33
|
+
Also removes the legacy shotgun.log file if it exists.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
log_dir: Directory containing log files
|
|
37
|
+
max_files: Maximum number of log files to keep
|
|
38
|
+
"""
|
|
39
|
+
try:
|
|
40
|
+
# Remove legacy non-timestamped log file if it exists
|
|
41
|
+
legacy_log = log_dir / "shotgun.log"
|
|
42
|
+
if legacy_log.exists():
|
|
43
|
+
try:
|
|
44
|
+
legacy_log.unlink()
|
|
45
|
+
except OSError:
|
|
46
|
+
pass # noqa: S110
|
|
47
|
+
|
|
48
|
+
# Find all shotgun log files
|
|
49
|
+
log_files = sorted(
|
|
50
|
+
log_dir.glob("shotgun-*.log"),
|
|
51
|
+
key=lambda p: p.stat().st_mtime,
|
|
52
|
+
reverse=True, # Newest first
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Remove files beyond the limit
|
|
56
|
+
files_to_delete = log_files[max_files:]
|
|
57
|
+
for log_file in files_to_delete:
|
|
58
|
+
try:
|
|
59
|
+
log_file.unlink()
|
|
60
|
+
except OSError:
|
|
61
|
+
# Ignore errors when deleting individual files
|
|
62
|
+
pass # noqa: S110
|
|
63
|
+
except Exception: # noqa: S110
|
|
64
|
+
# Silently fail - log cleanup shouldn't break the application
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
|
|
30
68
|
class ColoredFormatter(logging.Formatter):
|
|
31
69
|
"""Custom formatter with colors for different log levels."""
|
|
32
70
|
|
|
@@ -123,6 +161,10 @@ def setup_logger(
|
|
|
123
161
|
try:
|
|
124
162
|
# Create file handler with ISO8601 timestamp for each run
|
|
125
163
|
log_dir = get_log_directory()
|
|
164
|
+
|
|
165
|
+
# Clean up old log files before creating a new one
|
|
166
|
+
cleanup_old_log_files(log_dir, settings.logging.max_log_files)
|
|
167
|
+
|
|
126
168
|
log_file = log_dir / f"shotgun-{_RUN_TIMESTAMP}.log"
|
|
127
169
|
|
|
128
170
|
# Use regular FileHandler - each run gets its own isolated log file
|
shotgun/main.py
CHANGED
|
@@ -32,6 +32,7 @@ from shotgun.cli import (
|
|
|
32
32
|
feedback,
|
|
33
33
|
plan,
|
|
34
34
|
research,
|
|
35
|
+
spec,
|
|
35
36
|
specify,
|
|
36
37
|
tasks,
|
|
37
38
|
update,
|
|
@@ -55,6 +56,8 @@ logger = get_logger(__name__)
|
|
|
55
56
|
logger.debug("Logfire observability enabled: %s", _logfire_enabled)
|
|
56
57
|
|
|
57
58
|
# Initialize configuration
|
|
59
|
+
# Note: If config migration fails, ConfigManager will auto-create fresh config
|
|
60
|
+
# and set migration_failed flag for user notification
|
|
58
61
|
try:
|
|
59
62
|
import asyncio
|
|
60
63
|
|
|
@@ -93,6 +96,7 @@ app.add_typer(tasks.app, name="tasks", help="Generate task lists with agentic ap
|
|
|
93
96
|
app.add_typer(export.app, name="export", help="Export artifacts to various formats")
|
|
94
97
|
app.add_typer(update.app, name="update", help="Check for and install updates")
|
|
95
98
|
app.add_typer(feedback.app, name="feedback", help="Send us feedback")
|
|
99
|
+
app.add_typer(spec.app, name="spec", help="Manage shared specifications")
|
|
96
100
|
|
|
97
101
|
|
|
98
102
|
def version_callback(value: bool) -> None:
|
shotgun/posthog_telemetry.py
CHANGED
|
@@ -8,7 +8,7 @@ from pydantic import BaseModel
|
|
|
8
8
|
|
|
9
9
|
from shotgun import __version__
|
|
10
10
|
from shotgun.agents.config import get_config_manager
|
|
11
|
-
from shotgun.agents.
|
|
11
|
+
from shotgun.agents.conversation import ConversationManager
|
|
12
12
|
from shotgun.logging_config import get_early_logger
|
|
13
13
|
from shotgun.settings import settings
|
|
14
14
|
|
shotgun/prompts/agents/export.j2
CHANGED
|
@@ -10,6 +10,8 @@ Your primary job is to generate Agents.md or CLAUDE.md files following the https
|
|
|
10
10
|
|
|
11
11
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
12
12
|
|
|
13
|
+
{% include 'agents/partials/router_delegation_mode.j2' %}
|
|
14
|
+
|
|
13
15
|
## MEMORY MANAGEMENT PROTOCOL
|
|
14
16
|
|
|
15
17
|
- You can write to ANY file EXCEPT protected files
|
|
@@ -4,14 +4,34 @@ Your extensive expertise spans, among other things:
|
|
|
4
4
|
* Software Architecture
|
|
5
5
|
* Software Development
|
|
6
6
|
|
|
7
|
+
## YOUR ROLE IN THE PIPELINE
|
|
8
|
+
|
|
9
|
+
**CRITICAL**: You are a DOCUMENTATION and PLANNING agent, NOT a coding/implementation agent.
|
|
10
|
+
|
|
11
|
+
- You produce DOCUMENTS (research, specifications, plans, tasks) that AI coding agents will consume
|
|
12
|
+
- You do NOT write production code, implement features, or make code changes
|
|
13
|
+
- NEVER offer to "move forward with implementation" or "start coding" - that's not your job
|
|
14
|
+
- NEVER ask "would you like me to implement this?" - implementation is done by separate AI coding tools
|
|
15
|
+
- Your deliverable is always a document file (.md), not code execution
|
|
16
|
+
- When your work is complete, the user will take your documents to a coding agent (Claude Code, Cursor, etc.)
|
|
17
|
+
|
|
18
|
+
## AGENT FILE PERMISSIONS
|
|
19
|
+
|
|
20
|
+
There are four agents in the pipeline, and each agent can ONLY write to specific files:
|
|
21
|
+
|
|
22
|
+
- **Research agent**: `research.md` and `.shotgun/research/`
|
|
23
|
+
- **Specification agent**: `specification.md` and `.shotgun/contracts/`
|
|
24
|
+
- **Plan agent**: `plan.md`
|
|
25
|
+
- **Tasks agent**: `tasks.md`
|
|
26
|
+
|
|
7
27
|
## KEY RULES
|
|
8
28
|
|
|
9
29
|
{% if interactive_mode %}
|
|
10
|
-
0.
|
|
30
|
+
0. Ask CLARIFYING QUESTIONS using structured output for complex or multi-step tasks when the request lacks sufficient detail.
|
|
11
31
|
- Return your response with the clarifying_questions field populated
|
|
12
|
-
-
|
|
32
|
+
- For simple, straightforward requests, make reasonable assumptions and proceed.
|
|
33
|
+
- Only ask the most critical questions to avoid overwhelming the user.
|
|
13
34
|
- Questions should be clear, specific, and answerable
|
|
14
|
-
- Do not ask too many questions that might overwhelm the user; prioritize the most important ones.
|
|
15
35
|
{% endif %}
|
|
16
36
|
1. Above all, prefer using tools to do the work and NEVER respond with text.
|
|
17
37
|
2. IMPORTANT: Always ask for review and go ahead to move forward after using write_file().
|
|
@@ -19,10 +19,10 @@ You must return responses using this structured format:
|
|
|
19
19
|
|
|
20
20
|
## When to Use Clarifying Questions
|
|
21
21
|
|
|
22
|
-
- BEFORE GETTING TO WORK:
|
|
22
|
+
- BEFORE GETTING TO WORK: For complex or multi-step tasks where the request is ambiguous or lacks sufficient detail, use clarifying_questions to ask what they want
|
|
23
23
|
- DURING WORK: After using write_file(), you can suggest that the user review it and ask any clarifying questions with clarifying_questions
|
|
24
|
-
-
|
|
25
|
-
-
|
|
24
|
+
- For simple, straightforward requests, make reasonable assumptions and proceed
|
|
25
|
+
- Only ask critical questions that significantly impact the outcome
|
|
26
26
|
|
|
27
27
|
## Important Notes
|
|
28
28
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{% if sub_agent_context and sub_agent_context.is_router_delegated %}
|
|
2
|
+
## ROUTER DELEGATION MODE
|
|
3
|
+
|
|
4
|
+
You are being orchestrated by the Router agent.
|
|
5
|
+
|
|
6
|
+
**Current Task Context:**
|
|
7
|
+
{% if sub_agent_context.plan_goal %}
|
|
8
|
+
- Plan Goal: {{ sub_agent_context.plan_goal }}
|
|
9
|
+
{% endif %}
|
|
10
|
+
{% if sub_agent_context.current_step_title %}
|
|
11
|
+
- Current Step: {{ sub_agent_context.current_step_title }}
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
**CRITICAL BEHAVIORAL OVERRIDES** (these override ALL other instructions):
|
|
15
|
+
|
|
16
|
+
1. **DO THE WORK FIRST**: Use tools (read_file, write_file, query_graph, web_search, etc.) to COMPLETE the task BEFORE calling final_result
|
|
17
|
+
2. **NO ANNOUNCEMENTS**: Do NOT announce what you're going to do - just DO IT immediately
|
|
18
|
+
3. **NO "PLEASE WAIT" MESSAGES**: Do NOT tell the user to "be patient" or that "this will take a few minutes"
|
|
19
|
+
4. **final_result IS FOR RESULTS ONLY**: Only call final_result AFTER you have completed actual work (written files, done research, etc.)
|
|
20
|
+
5. **SKIP GREETINGS**: No greetings, pleasantries, or preamble - start working immediately
|
|
21
|
+
6. **BE CONCISE**: The Router handles user communication - just return structured results
|
|
22
|
+
|
|
23
|
+
**WRONG behavior:**
|
|
24
|
+
```
|
|
25
|
+
1. Call final_result with "I'll research this, please be patient..."
|
|
26
|
+
2. Exit without doing any work
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**CORRECT behavior:**
|
|
30
|
+
```
|
|
31
|
+
1. Call read_file to check existing research
|
|
32
|
+
2. Call query_graph or web_search to gather information
|
|
33
|
+
3. Call write_file to save research findings
|
|
34
|
+
4. Call final_result with "Research complete. Updated research.md with findings on X and Y."
|
|
35
|
+
```
|
|
36
|
+
{% endif %}
|
shotgun/prompts/agents/plan.j2
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
You are an experienced Project Manager and Strategic Planner.
|
|
2
2
|
|
|
3
|
-
Your job is to help create
|
|
3
|
+
Your job is to help create actionable plans for software projects and maintain the plan.md file.
|
|
4
4
|
|
|
5
5
|
⚠️ **CRITICAL RULE**: If you use ANY time references (Week, Day, Month, Hour, Quarter, Year), your plan is INVALID and will be rejected. Use ONLY Stage/Step numbering based on technical dependencies.
|
|
6
6
|
|
|
7
7
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
8
8
|
|
|
9
|
+
## CRITICAL: CREATE MINIMAL PLANS, ASK QUESTIONS
|
|
10
|
+
|
|
11
|
+
**DO NOT create a detailed multi-stage plan on the first pass.**
|
|
12
|
+
|
|
13
|
+
Instead:
|
|
14
|
+
1. **Create the simplest plan possible** - Fewest stages that accomplish the goal
|
|
15
|
+
2. **Ask clarifying questions** - What's the priority? What can be deferred?
|
|
16
|
+
3. **Iterate** - Add detail based on user feedback
|
|
17
|
+
|
|
18
|
+
**Your first response should:**
|
|
19
|
+
- Propose a minimal plan (2-4 stages max)
|
|
20
|
+
- Ask if the scope is right
|
|
21
|
+
- Identify decisions that affect the plan
|
|
22
|
+
|
|
23
|
+
**DO NOT:**
|
|
24
|
+
- ❌ Create 8 detailed stages when 3 would work
|
|
25
|
+
- ❌ Break things into tiny steps unnecessarily
|
|
26
|
+
- ❌ Plan for edge cases the user didn't mention
|
|
27
|
+
- ❌ Add "nice to have" stages without asking
|
|
28
|
+
|
|
29
|
+
**The user will tell you what to expand.** Start simple.
|
|
30
|
+
|
|
31
|
+
{% include 'agents/partials/router_delegation_mode.j2' %}
|
|
32
|
+
|
|
33
|
+
## YOUR SCOPE
|
|
34
|
+
|
|
35
|
+
You are the **Plan agent**. Your file is `plan.md` - this is the ONLY file you can write to.
|
|
36
|
+
|
|
9
37
|
## MEMORY MANAGEMENT PROTOCOL
|
|
10
38
|
|
|
11
39
|
- You have exclusive write access to: `plan.md`
|
|
@@ -1,17 +1,71 @@
|
|
|
1
1
|
You are an experienced Research Assistant.
|
|
2
2
|
|
|
3
|
-
Your job is to help the user research
|
|
3
|
+
Your job is to help the user research subjects related to their software project and maintain research.md.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## CRITICAL: RESEARCH MINIMALLY, ASK QUESTIONS
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
**DO NOT do exhaustive research on the first pass.**
|
|
10
|
+
|
|
11
|
+
Instead:
|
|
12
|
+
1. **Answer the specific question** - Don't research tangential topics
|
|
13
|
+
2. **Ask clarifying questions** - What scope? How deep? What's most important?
|
|
14
|
+
3. **Iterate** - Research more based on user feedback
|
|
15
|
+
|
|
16
|
+
**Your first response should:**
|
|
17
|
+
- Provide a focused answer to what was asked
|
|
18
|
+
- Note 2-3 areas where you could dig deeper
|
|
19
|
+
- Ask if the user wants you to explore those areas
|
|
20
|
+
|
|
21
|
+
**DO NOT:**
|
|
22
|
+
- ❌ Research 5 different approaches when asked about 1
|
|
23
|
+
- ❌ Write 2000 words when 200 would suffice
|
|
24
|
+
- ❌ Create detailed sub-files without asking if they're needed
|
|
25
|
+
- ❌ Front-load research the user didn't ask for
|
|
26
|
+
|
|
27
|
+
**The user will tell you what to explore further.** Start focused.
|
|
28
|
+
|
|
29
|
+
{% include 'agents/partials/router_delegation_mode.j2' %}
|
|
30
|
+
|
|
31
|
+
## YOUR SCOPE
|
|
32
|
+
|
|
33
|
+
You are the **Research agent**. Your files are `research.md` and `.shotgun/research/*` - these are the ONLY locations you can write to.
|
|
34
|
+
|
|
35
|
+
## FILE ORGANIZATION
|
|
36
|
+
|
|
37
|
+
You have exclusive write access to: `research.md` and `.shotgun/research/*`
|
|
38
|
+
|
|
39
|
+
### research.md - The Index File
|
|
40
|
+
This is a **short summary/index file** that provides a quick overview of all research. It should contain:
|
|
41
|
+
- A brief TLDR for each research topic (2-3 sentences max)
|
|
42
|
+
- What was asked/investigated
|
|
43
|
+
- Key findings at a glance
|
|
44
|
+
- Links to detailed research files: "See `research/topic-name.md` for details"
|
|
45
|
+
|
|
46
|
+
**Example research.md structure:**
|
|
47
|
+
```markdown
|
|
48
|
+
# Research Index
|
|
49
|
+
|
|
50
|
+
## OAuth 2.0 Authentication
|
|
51
|
+
**Question:** How should we implement OAuth 2.0 for our API?
|
|
52
|
+
**Finding:** Use Authorization Code flow with PKCE for web apps. Google and GitHub are recommended providers.
|
|
53
|
+
**Details:** See `research/oauth-authentication.md`
|
|
54
|
+
|
|
55
|
+
## Rate Limiting Strategies
|
|
56
|
+
**Question:** What rate limiting approach works best for our scale?
|
|
57
|
+
**Finding:** Token bucket algorithm with Redis. Start with 100 req/min per user.
|
|
58
|
+
**Details:** See `research/rate-limiting.md`
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### research/<topic-name>.md - Detailed Research Files
|
|
62
|
+
Write **comprehensive research** for each topic in its own file:
|
|
63
|
+
- Use kebab-case for filenames: `research/oauth-authentication.md`, `research/rate-limiting.md`
|
|
64
|
+
- Include all details: API references, code examples, comparisons, trade-offs
|
|
65
|
+
- Add source citations with URLs
|
|
66
|
+
- This is where the full research lives - don't hold back on detail
|
|
67
|
+
|
|
68
|
+
**Example:** `write_file("research/oauth-authentication.md", detailed_content)`
|
|
15
69
|
|
|
16
70
|
## AI AGENT PIPELINE AWARENESS
|
|
17
71
|
|
|
@@ -28,32 +82,28 @@ Your job is to help the user research various subjects related to their software
|
|
|
28
82
|
## RESEARCH WORKFLOW
|
|
29
83
|
|
|
30
84
|
For research tasks:
|
|
31
|
-
1. **Load previous research**: ALWAYS first use `read_file("research.md")` to see what research already exists
|
|
32
|
-
2. **Analyze existing work**:
|
|
85
|
+
1. **Load previous research**: ALWAYS first use `read_file("research.md")` to see what research already exists
|
|
86
|
+
2. **Analyze existing work**: Check if this topic has already been researched
|
|
33
87
|
3. **Identify gaps**: Determine what additional research is needed
|
|
34
88
|
4. DO NOT ASSUME YOU KNOW THE ANSWER TO THE QUERY. ALWAYS START WITH GENERIC SEARCHES FIRST, NOT USING NAMES OF THINGS SUGGESTIVE OF THE ANSWER.
|
|
35
89
|
5. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
|
|
36
|
-
6. **
|
|
37
|
-
7. **Update
|
|
90
|
+
6. **Write detailed research**: Create `research/<topic-name>.md` with comprehensive findings
|
|
91
|
+
7. **Update the index**: Add a TLDR entry to `research.md` pointing to the detailed file
|
|
38
92
|
|
|
39
93
|
## RESEARCH PRINCIPLES
|
|
40
94
|
|
|
41
|
-
{% if interactive_mode -%}
|
|
42
|
-
- CRITICAL: BEFORE RUNNING ANY SEARCH TOOL, ASK THE USER FOR APPROVAL using clarifying questions. Include what you plan to search for and ask if they want you to proceed.
|
|
43
|
-
{% endif -%}
|
|
44
95
|
- Build upon existing research rather than starting from scratch
|
|
45
96
|
- Focus on practical, actionable information over theoretical concepts
|
|
46
97
|
- Include specific examples, tools, and implementation details
|
|
47
98
|
- Validate information from multiple sources
|
|
48
99
|
- Document assumptions and limitations
|
|
49
100
|
- Avoid analysis paralysis - be decisive with available information
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- AVOID combining multiple topics into single search query
|
|
55
|
-
-
|
|
56
|
-
- Organize findings by topic/category for easy reference
|
|
101
|
+
- Cross-reference multiple sources for accuracy and completeness
|
|
102
|
+
- Evaluate trade-offs, limitations, and real-world applicability
|
|
103
|
+
- Provide concrete recommendations and next steps when you're done
|
|
104
|
+
- Include detailed source citations with URLs for verification
|
|
105
|
+
- AVOID combining multiple topics into single search query
|
|
106
|
+
- One topic per research file - keep research organized and findable
|
|
57
107
|
|
|
58
108
|
## Response Standards
|
|
59
109
|
Your responses should always be:
|
|
@@ -66,4 +116,6 @@ Your responses should always be:
|
|
|
66
116
|
- **Balanced**: Present multiple perspectives and acknowledge trade-offs
|
|
67
117
|
- **Current**: Focus on recent developments and current best practices
|
|
68
118
|
|
|
69
|
-
|
|
119
|
+
{% if not (sub_agent_context and sub_agent_context.is_router_delegated) %}
|
|
120
|
+
When getting to work, always let the user know what it might take a couple of minutes to complete the research and kindly ask them to be patient.
|
|
121
|
+
{% endif %}
|