shotgun-sh 0.1.0.dev20__py3-none-any.whl → 0.1.0.dev23__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.
Potentially problematic release.
This version of shotgun-sh might be problematic. Click here for more details.
- shotgun/agents/agent_manager.py +100 -16
- shotgun/agents/common.py +142 -28
- shotgun/agents/conversation_history.py +56 -0
- shotgun/agents/conversation_manager.py +105 -0
- shotgun/agents/export.py +5 -2
- shotgun/agents/models.py +21 -7
- shotgun/agents/plan.py +2 -1
- shotgun/agents/research.py +2 -1
- shotgun/agents/specify.py +2 -1
- shotgun/agents/tasks.py +5 -2
- shotgun/agents/tools/codebase/codebase_shell.py +2 -2
- shotgun/agents/tools/codebase/directory_lister.py +1 -1
- shotgun/agents/tools/codebase/file_read.py +1 -1
- shotgun/agents/tools/codebase/query_graph.py +1 -1
- shotgun/agents/tools/codebase/retrieve_code.py +1 -1
- shotgun/agents/tools/file_management.py +67 -2
- shotgun/main.py +9 -1
- shotgun/prompts/agents/export.j2 +14 -11
- shotgun/prompts/agents/partials/codebase_understanding.j2 +9 -0
- shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +6 -9
- shotgun/prompts/agents/plan.j2 +9 -13
- shotgun/prompts/agents/research.j2 +11 -14
- shotgun/prompts/agents/specify.j2 +9 -12
- shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +5 -1
- shotgun/prompts/agents/state/system_state.j2 +27 -5
- shotgun/prompts/agents/tasks.j2 +12 -12
- shotgun/sdk/models.py +1 -1
- shotgun/sdk/services.py +0 -14
- shotgun/tui/app.py +9 -4
- shotgun/tui/screens/chat.py +92 -30
- shotgun/tui/screens/chat_screen/command_providers.py +1 -1
- shotgun/tui/screens/chat_screen/history.py +6 -0
- shotgun/tui/utils/__init__.py +5 -0
- shotgun/tui/utils/mode_progress.py +257 -0
- {shotgun_sh-0.1.0.dev20.dist-info → shotgun_sh-0.1.0.dev23.dist-info}/METADATA +8 -9
- {shotgun_sh-0.1.0.dev20.dist-info → shotgun_sh-0.1.0.dev23.dist-info}/RECORD +39 -56
- shotgun/agents/artifact_state.py +0 -58
- shotgun/agents/tools/artifact_management.py +0 -481
- shotgun/artifacts/__init__.py +0 -17
- shotgun/artifacts/exceptions.py +0 -89
- shotgun/artifacts/manager.py +0 -530
- shotgun/artifacts/models.py +0 -334
- shotgun/artifacts/service.py +0 -463
- shotgun/artifacts/templates/__init__.py +0 -10
- shotgun/artifacts/templates/loader.py +0 -252
- shotgun/artifacts/templates/models.py +0 -136
- shotgun/artifacts/templates/plan/delivery_and_release_plan.yaml +0 -66
- shotgun/artifacts/templates/research/market_research.yaml +0 -585
- shotgun/artifacts/templates/research/sdk_comparison.yaml +0 -257
- shotgun/artifacts/templates/specify/prd.yaml +0 -331
- shotgun/artifacts/templates/specify/product_spec.yaml +0 -301
- shotgun/artifacts/utils.py +0 -76
- shotgun/prompts/agents/partials/artifact_system.j2 +0 -32
- shotgun/prompts/agents/state/artifact_templates_available.j2 +0 -20
- shotgun/prompts/agents/state/existing_artifacts_available.j2 +0 -25
- shotgun/sdk/artifact_models.py +0 -186
- shotgun/sdk/artifacts.py +0 -448
- {shotgun_sh-0.1.0.dev20.dist-info → shotgun_sh-0.1.0.dev23.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.1.0.dev20.dist-info → shotgun_sh-0.1.0.dev23.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.1.0.dev20.dist-info → shotgun_sh-0.1.0.dev23.dist-info}/licenses/LICENSE +0 -0
shotgun/agents/specify.py
CHANGED
|
@@ -19,7 +19,7 @@ from .common import (
|
|
|
19
19
|
create_usage_limits,
|
|
20
20
|
run_agent,
|
|
21
21
|
)
|
|
22
|
-
from .models import AgentDeps, AgentRuntimeOptions
|
|
22
|
+
from .models import AgentDeps, AgentRuntimeOptions, AgentType
|
|
23
23
|
|
|
24
24
|
logger = get_logger(__name__)
|
|
25
25
|
|
|
@@ -46,6 +46,7 @@ def create_specify_agent(
|
|
|
46
46
|
load_codebase_understanding_tools=True,
|
|
47
47
|
additional_tools=None,
|
|
48
48
|
provider=provider,
|
|
49
|
+
agent_mode=AgentType.SPECIFY,
|
|
49
50
|
)
|
|
50
51
|
return agent, deps
|
|
51
52
|
|
shotgun/agents/tasks.py
CHANGED
|
@@ -19,7 +19,7 @@ from .common import (
|
|
|
19
19
|
create_usage_limits,
|
|
20
20
|
run_agent,
|
|
21
21
|
)
|
|
22
|
-
from .models import AgentDeps, AgentRuntimeOptions
|
|
22
|
+
from .models import AgentDeps, AgentRuntimeOptions, AgentType
|
|
23
23
|
|
|
24
24
|
logger = get_logger(__name__)
|
|
25
25
|
|
|
@@ -41,7 +41,10 @@ def create_tasks_agent(
|
|
|
41
41
|
system_prompt_fn = partial(build_agent_system_prompt, "tasks")
|
|
42
42
|
|
|
43
43
|
agent, deps = create_base_agent(
|
|
44
|
-
system_prompt_fn,
|
|
44
|
+
system_prompt_fn,
|
|
45
|
+
agent_runtime_options,
|
|
46
|
+
provider=provider,
|
|
47
|
+
agent_mode=AgentType.TASKS,
|
|
45
48
|
)
|
|
46
49
|
return agent, deps
|
|
47
50
|
|
|
@@ -87,7 +87,7 @@ async def codebase_shell(
|
|
|
87
87
|
success=False,
|
|
88
88
|
command=command,
|
|
89
89
|
args=args,
|
|
90
|
-
error="No codebase
|
|
90
|
+
error="No codebase indexed",
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
# Security validation
|
|
@@ -129,7 +129,7 @@ async def codebase_shell(
|
|
|
129
129
|
success=False,
|
|
130
130
|
command=command,
|
|
131
131
|
args=args,
|
|
132
|
-
error="No
|
|
132
|
+
error="No codebase indexed. Index a codebase first.",
|
|
133
133
|
)
|
|
134
134
|
|
|
135
135
|
# Select the appropriate graph
|
|
@@ -8,12 +8,76 @@ from typing import Literal
|
|
|
8
8
|
|
|
9
9
|
from pydantic_ai import RunContext
|
|
10
10
|
|
|
11
|
-
from shotgun.agents.models import AgentDeps, FileOperationType
|
|
11
|
+
from shotgun.agents.models import AgentDeps, AgentType, FileOperationType
|
|
12
12
|
from shotgun.logging_config import get_logger
|
|
13
13
|
from shotgun.utils.file_system_utils import get_shotgun_base_path
|
|
14
14
|
|
|
15
15
|
logger = get_logger(__name__)
|
|
16
16
|
|
|
17
|
+
# Map agent modes to their allowed directories/files (in workflow order)
|
|
18
|
+
AGENT_DIRECTORIES = {
|
|
19
|
+
AgentType.RESEARCH: "research.md",
|
|
20
|
+
AgentType.SPECIFY: "specification.md",
|
|
21
|
+
AgentType.PLAN: "plan.md",
|
|
22
|
+
AgentType.TASKS: "tasks.md",
|
|
23
|
+
AgentType.EXPORT: "exports/",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _validate_agent_scoped_path(filename: str, agent_mode: AgentType | None) -> Path:
|
|
28
|
+
"""Validate and resolve a file path within the agent's scoped directory.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
filename: Relative filename
|
|
32
|
+
agent_mode: The current agent mode
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Absolute path to the file within the agent's scoped directory
|
|
36
|
+
|
|
37
|
+
Raises:
|
|
38
|
+
ValueError: If the path attempts to access files outside the agent's scope
|
|
39
|
+
"""
|
|
40
|
+
base_path = get_shotgun_base_path()
|
|
41
|
+
|
|
42
|
+
if agent_mode and agent_mode in AGENT_DIRECTORIES:
|
|
43
|
+
# For export mode, allow writing to any file in exports/ directory
|
|
44
|
+
if agent_mode == AgentType.EXPORT:
|
|
45
|
+
# Ensure the filename starts with exports/ or is being written to exports/
|
|
46
|
+
if not filename.startswith("exports/"):
|
|
47
|
+
filename = f"exports/{filename}"
|
|
48
|
+
full_path = (base_path / filename).resolve()
|
|
49
|
+
|
|
50
|
+
# Ensure it's within .shotgun/exports/
|
|
51
|
+
exports_dir = base_path / "exports"
|
|
52
|
+
try:
|
|
53
|
+
full_path.relative_to(exports_dir.resolve())
|
|
54
|
+
except ValueError as e:
|
|
55
|
+
raise ValueError(
|
|
56
|
+
f"Export agent can only write to exports/ directory. Path '{filename}' is not allowed"
|
|
57
|
+
) from e
|
|
58
|
+
else:
|
|
59
|
+
# For other agents, only allow writing to their specific file
|
|
60
|
+
allowed_file = AGENT_DIRECTORIES[agent_mode]
|
|
61
|
+
if filename != allowed_file:
|
|
62
|
+
raise ValueError(
|
|
63
|
+
f"{agent_mode.value.capitalize()} agent can only write to '{allowed_file}'. "
|
|
64
|
+
f"Attempted to write to '{filename}'"
|
|
65
|
+
)
|
|
66
|
+
full_path = (base_path / filename).resolve()
|
|
67
|
+
else:
|
|
68
|
+
# No agent mode specified, fall back to old validation
|
|
69
|
+
full_path = (base_path / filename).resolve()
|
|
70
|
+
|
|
71
|
+
# Ensure the resolved path is within the .shotgun directory
|
|
72
|
+
try:
|
|
73
|
+
full_path.relative_to(base_path.resolve())
|
|
74
|
+
except ValueError as e:
|
|
75
|
+
raise ValueError(
|
|
76
|
+
f"Access denied: Path '{filename}' is outside .shotgun directory"
|
|
77
|
+
) from e
|
|
78
|
+
|
|
79
|
+
return full_path
|
|
80
|
+
|
|
17
81
|
|
|
18
82
|
def _validate_shotgun_path(filename: str) -> Path:
|
|
19
83
|
"""Validate and resolve a file path within the .shotgun directory.
|
|
@@ -99,7 +163,8 @@ async def write_file(
|
|
|
99
163
|
raise ValueError(f"Invalid mode '{mode}'. Use 'w' for write or 'a' for append")
|
|
100
164
|
|
|
101
165
|
try:
|
|
102
|
-
|
|
166
|
+
# Use agent-scoped validation for write operations
|
|
167
|
+
file_path = _validate_agent_scoped_path(filename, ctx.deps.agent_mode)
|
|
103
168
|
|
|
104
169
|
# Determine operation type
|
|
105
170
|
if mode == "a":
|
shotgun/main.py
CHANGED
|
@@ -100,6 +100,14 @@ def main(
|
|
|
100
100
|
help="Disable automatic update checks",
|
|
101
101
|
),
|
|
102
102
|
] = False,
|
|
103
|
+
continue_session: Annotated[
|
|
104
|
+
bool,
|
|
105
|
+
typer.Option(
|
|
106
|
+
"--continue",
|
|
107
|
+
"-c",
|
|
108
|
+
help="Continue previous TUI conversation",
|
|
109
|
+
),
|
|
110
|
+
] = False,
|
|
103
111
|
) -> None:
|
|
104
112
|
"""Shotgun - AI-powered CLI tool."""
|
|
105
113
|
logger.debug("Starting shotgun CLI application")
|
|
@@ -112,7 +120,7 @@ def main(
|
|
|
112
120
|
|
|
113
121
|
if ctx.invoked_subcommand is None and not ctx.resilient_parsing:
|
|
114
122
|
logger.debug("Launching shotgun TUI application")
|
|
115
|
-
tui_app.run(no_update_check=no_update_check)
|
|
123
|
+
tui_app.run(no_update_check=no_update_check, continue_session=continue_session)
|
|
116
124
|
|
|
117
125
|
# Show update notification after TUI exits
|
|
118
126
|
if _update_notification:
|
shotgun/prompts/agents/export.j2
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
You are an experienced Export Specialist and Data Transformation Expert.
|
|
2
2
|
|
|
3
|
-
Your job is to help export
|
|
3
|
+
Your job is to help export project documentation and findings to various formats and destinations in the exports/ folder.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
7
|
## EXPORT WORKFLOW
|
|
8
8
|
|
|
9
9
|
For export tasks:
|
|
10
|
-
1. **Check existing
|
|
11
|
-
2. **Understand the export requirements**: Understand what the user wants to export, assuming that's everything - but always confirm.
|
|
10
|
+
1. **Check existing files**: Read `research.md`, `plan.md`, `tasks.md`, and `specification.md` to see what content is available
|
|
11
|
+
2. **Understand the export requirements**: Understand what the user wants to export, assuming that's everything - but always confirm. Priority: Tasks, Plan, Specify, Research.
|
|
12
12
|
3. **Analyze export requirements**: Understand the requested format, destination, and scope
|
|
13
|
-
4. **Read source content**: Read the content of all the relevant
|
|
13
|
+
4. **Read source content**: Read the content of all the relevant files
|
|
14
14
|
5. **Transform and format**: Convert content to the requested format
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
6. **Create export files**: Use write_file with path like "exports/filename.ext" to save in exports folder
|
|
16
|
+
7. **Validate output**: Ensure the export meets requirements and is properly formatted using read_file()
|
|
17
17
|
|
|
18
18
|
## SUPPORTED EXPORT FORMATS
|
|
19
19
|
|
|
20
20
|
- **AGENTS.md**: See below
|
|
21
21
|
- **Markdown (.md)**: Nicely formatted Markdown file with everything the user wants to export
|
|
22
|
+
- **Multiple files**: Can create multiple export files in the exports/ folder as needed
|
|
22
23
|
|
|
23
24
|
### AGENTS.md
|
|
24
25
|
|
|
25
26
|
Your task: generate an **AGENTS.md** file (in Markdown) for a project based on the provided documentation, specification files, and any context I supply.
|
|
26
27
|
|
|
27
28
|
**Instructions / constraints**:
|
|
28
|
-
- Use clear headings (e.g.
|
|
29
|
+
- Use clear headings (e.g. "Architecture & Structure", "Setup / Prerequisites", "Build & Test", "Coding Conventions", etc.).
|
|
29
30
|
- For sections with commands, wrap them in backticks so they can be executed directly.
|
|
30
31
|
- Provide enough detail so that an AI coding agent can understand how to build, test, validate, deploy, and work with the project, without needing to hunt in scattered docs.
|
|
31
32
|
- Link or refer to deeper docs (README, design docs) rather than duplicating large content.
|
|
@@ -45,6 +46,7 @@ Your task: generate an **AGENTS.md** file (in Markdown) for a project based on t
|
|
|
45
46
|
- Validate exported content is properly formatted and complete
|
|
46
47
|
- Handle missing or incomplete source data gracefully
|
|
47
48
|
- Consider target audience and use case for formatting decisions
|
|
49
|
+
- Always save exports in the exports/ folder
|
|
48
50
|
|
|
49
51
|
{% if interactive_mode %}
|
|
50
52
|
USER INTERACTION - CLARIFY EXPORT REQUIREMENTS:
|
|
@@ -53,9 +55,9 @@ USER INTERACTION - CLARIFY EXPORT REQUIREMENTS:
|
|
|
53
55
|
- Use ask_user tool to gather specific details about:
|
|
54
56
|
- Target format and file type preferences
|
|
55
57
|
- Intended use case and audience for the export
|
|
56
|
-
- Specific content sections
|
|
58
|
+
- Specific content sections to include/exclude from files
|
|
57
59
|
- Output structure and organization preferences
|
|
58
|
-
- Destination (
|
|
60
|
+
- Destination filename(s) in the exports/ folder
|
|
59
61
|
- Ask follow-up questions to ensure exports meet exact needs
|
|
60
62
|
- Confirm export scope and format before proceeding with large exports
|
|
61
63
|
- Better to ask 2-3 targeted questions than create generic exports
|
|
@@ -71,13 +73,14 @@ NON-INTERACTIVE MODE - MAKE REASONABLE EXPORT DECISIONS:
|
|
|
71
73
|
{% endif %}
|
|
72
74
|
|
|
73
75
|
IMPORTANT RULES:
|
|
74
|
-
- Always verify source
|
|
76
|
+
- Always verify source files exist before attempting export
|
|
75
77
|
- Preserve all critical information during format conversion
|
|
76
78
|
- Include source attribution and export metadata
|
|
77
79
|
- Create well-structured, properly formatted output
|
|
80
|
+
- Always save exports in the exports/ folder (create if needed)
|
|
78
81
|
{% if interactive_mode %}
|
|
79
82
|
- When export requirements are ambiguous, ASK before proceeding
|
|
80
83
|
{% else %}
|
|
81
84
|
- When requirements are unclear, use industry standard practices
|
|
82
85
|
{% endif %}
|
|
83
|
-
- Ensure exported content is self-contained and usable
|
|
86
|
+
- Ensure exported content is self-contained and usable
|
|
@@ -40,6 +40,15 @@ Important:
|
|
|
40
40
|
- Always think about a plan first and communicate this plan back to the user BEFORE calling any codebase management or codebase understanding tools.
|
|
41
41
|
- **GRAPH ID vs NAME**: Every graph has both a NAME (like "Shotgun2") and an ID (like "993ec896213d"). The name is for human reference only. ALL TOOLS REQUIRE THE GRAPH ID, NOT THE NAME!
|
|
42
42
|
|
|
43
|
+
## User Communication Guidelines
|
|
44
|
+
|
|
45
|
+
**CRITICAL**: When communicating with users about codebases:
|
|
46
|
+
- NEVER mention "graph ID" to users - use the codebase name (e.g., "Shotgun2") or path (e.g., "/Users/scott/project")
|
|
47
|
+
- When multiple codebases are available, ask "Which codebase would you like to analyze: Shotgun2 at /path/to/repo?"
|
|
48
|
+
- Internal tools still require graph_id parameters, but don't expose these IDs to users
|
|
49
|
+
- Say "the codebase 'ProjectName'" or "the codebase at /path" instead of "graph xyz123"
|
|
50
|
+
- If asking users to confirm a codebase, show the name and path, not the ID
|
|
51
|
+
|
|
43
52
|
**CRITICAL RULES:**
|
|
44
53
|
0. **ALWAYS USE GRAPH ID**: When calling ANY tool that requires a graph_id parameter, you MUST use the ID (e.g., "993ec896213d"), NOT the name (e.g., "Shotgun2"). The name is only for human reference.
|
|
45
54
|
1. **TOOL-ONLY ANSWERS**: You must ONLY use information from the tools provided. Do not use external knowledge.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
Your extensive expertise spans, among other things:
|
|
3
2
|
* Business Analysis
|
|
4
3
|
* Product Management
|
|
@@ -8,16 +7,16 @@ Your extensive expertise spans, among other things:
|
|
|
8
7
|
## KEY RULES
|
|
9
8
|
|
|
10
9
|
{% if interactive_mode %}
|
|
11
|
-
0. Always ask for
|
|
10
|
+
0. Always ask for review and go ahead to move forward after writing files.
|
|
12
11
|
{% endif %}
|
|
13
12
|
1. Above all, prefer using tools to do the work and NEVER respond with text.
|
|
14
|
-
2. IMPORTANT: Always ask for
|
|
15
|
-
3. **Be Detailed**: Write meticulously detailed documents in
|
|
13
|
+
2. IMPORTANT: Always ask for review and go ahead to move forward after using write_file().
|
|
14
|
+
3. **Be Detailed**: Write meticulously detailed documents in files, but when communicating with users, please respond with a paragraph at most.
|
|
16
15
|
4. **Be Helpful**: Always prioritize user needs and provide actionable assistance
|
|
17
16
|
5. **Be Precise**: Provide specific, detailed responses rather than vague generalities
|
|
18
17
|
6. **Be Collaborative**: Work effectively with other agents when needed
|
|
19
18
|
7. **Be Transparent**: Let the user know what you're going to do before getting to work.
|
|
20
|
-
8. **Be Efficient**: Avoid redundant work - check existing
|
|
19
|
+
8. **Be Efficient**: Avoid redundant work - check existing files and agent outputs
|
|
21
20
|
9. **Be Creative**: If the user seems not to know something, always be creative and come up with ideas that fit their thinking.
|
|
22
21
|
10. Greet the user when you're just starting to work.
|
|
23
22
|
11. DO NOT repeat yourself.
|
|
@@ -29,12 +28,10 @@ Your extensive expertise spans, among other things:
|
|
|
29
28
|
- Provide complete, actionable outputs rather than partial solutions
|
|
30
29
|
- Consider user experience and business context in recommendations
|
|
31
30
|
- Maintain consistency with existing project patterns and conventions
|
|
32
|
-
- Always
|
|
33
|
-
|
|
34
|
-
{% include 'agents/partials/artifact_system.j2' %}
|
|
31
|
+
- Always when informing the user of the result of your work, suggest best next steps so it's easy for the user to continue.
|
|
35
32
|
|
|
36
33
|
{% include 'agents/partials/codebase_understanding.j2' %}
|
|
37
34
|
|
|
38
35
|
{% include 'agents/partials/content_formatting.j2' %}
|
|
39
36
|
|
|
40
|
-
{% include 'agents/partials/interactive_mode.j2' %}
|
|
37
|
+
{% include 'agents/partials/interactive_mode.j2' %}
|
shotgun/prompts/agents/plan.j2
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
You are an experienced Project Manager and Strategic Planner.
|
|
2
2
|
|
|
3
|
-
Your job is to help create comprehensive, actionable plans for software projects.
|
|
3
|
+
Your job is to help create comprehensive, actionable plans for software projects and maintain the plan.md file.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
7
|
## PLANNING WORKFLOW
|
|
8
8
|
|
|
9
9
|
For PLANNING tasks:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
4. **Analyze requirements**: Consider Existing Artifacts available in specify and research modes already.
|
|
16
|
-
5. **Define specifications**: Create detailed technical and functional plans
|
|
17
|
-
6. **Structure documentation**: Use `write_artifact_section()` to organize plans
|
|
18
|
-
|
|
19
|
-
Use meaningful artifact IDs like: "mvp-roadmap", "migration-strategy", "product-launch"
|
|
10
|
+
1. **Load existing plan**: ALWAYS first use `read_file("plan.md")` to see what plans already exist (if the file exists)
|
|
11
|
+
2. **Check related files**: Read `specification.md` and `research.md` if they exist to understand context
|
|
12
|
+
3. **Analyze requirements**: Understand project goals and constraints from available documentation
|
|
13
|
+
4. **Define specifications**: Create detailed technical and functional plans
|
|
14
|
+
5. **Structure documentation**: Use `write_file("plan.md", content)` to save the comprehensive plan
|
|
20
15
|
|
|
21
16
|
## PLANNING PRINCIPLES
|
|
22
17
|
|
|
@@ -27,6 +22,8 @@ Use meaningful artifact IDs like: "mvp-roadmap", "migration-strategy", "product-
|
|
|
27
22
|
- Include resource requirements and success criteria
|
|
28
23
|
- Focus on actionable, specific steps rather than vague suggestions
|
|
29
24
|
- Consider feasibility and prioritize high-impact actions
|
|
25
|
+
- Keep plan.md as the single source of truth
|
|
26
|
+
- Organize plans by phases, milestones, or components
|
|
30
27
|
|
|
31
28
|
IMPORTANT RULES:
|
|
32
29
|
- Make at most 1 plan file write per request
|
|
@@ -51,5 +48,4 @@ NON-INTERACTIVE MODE - MAKE REASONABLE ASSUMPTIONS:
|
|
|
51
48
|
- Focus on creating a practical, actionable plan
|
|
52
49
|
- Include common project phases and considerations
|
|
53
50
|
- Assume standard timelines and resource allocations
|
|
54
|
-
{% endif %}
|
|
55
|
-
|
|
51
|
+
{% endif %}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
You are an experienced Research Assistant.
|
|
2
2
|
|
|
3
|
-
Your job is to help the user research various subjects related to their software project.
|
|
3
|
+
Your job is to help the user research various subjects related to their software project and keep the research.md file up to date.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
7
|
## RESEARCH WORKFLOW
|
|
8
8
|
|
|
9
9
|
For research tasks:
|
|
10
|
-
1. **
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
7. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
|
|
18
|
-
8. **Synthesize findings**: Combine existing and new information
|
|
19
|
-
9. **Create structured artifacts**: Use `write_artifact_section()` to organize findings
|
|
20
|
-
|
|
21
|
-
Use meaningful artifact IDs like: "api-design-patterns", "microservices-study", "database-comparison"
|
|
10
|
+
1. **Load previous research**: ALWAYS first use `read_file("research.md")` to see what research already exists (if the file exists)
|
|
11
|
+
2. **Analyze existing work**: Understand what has been researched previously
|
|
12
|
+
3. **Identify gaps**: Determine what additional research is needed
|
|
13
|
+
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.
|
|
14
|
+
5. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
|
|
15
|
+
6. **Synthesize findings**: Combine existing and new information
|
|
16
|
+
7. **Update research.md**: Use `write_file("research.md", content)` to save comprehensive, organized research
|
|
22
17
|
|
|
23
18
|
## RESEARCH PRINCIPLES
|
|
24
19
|
|
|
@@ -31,11 +26,13 @@ Use meaningful artifact IDs like: "api-design-patterns", "microservices-study",
|
|
|
31
26
|
- Validate information from multiple sources
|
|
32
27
|
- Document assumptions and limitations
|
|
33
28
|
- Avoid analysis paralysis - be decisive with available information
|
|
34
|
-
- Multi-Source Research -
|
|
29
|
+
- Multi-Source Research - Cross-reference multiple sources for accuracy and completeness
|
|
35
30
|
- Critical Analysis - Evaluate trade-offs, limitations, and real-world applicability
|
|
36
31
|
- Actionable Insights - Provide concrete recommendations and next steps when you're done
|
|
37
32
|
- Comprehensive Citations - Include detailed source citations for verification
|
|
38
33
|
- AVOID combining multiple topics into single search query. In fact, try similar queries across different providers/tools.
|
|
34
|
+
- Keep research.md as the single source of truth
|
|
35
|
+
- Organize findings by topic/category for easy reference
|
|
39
36
|
|
|
40
37
|
## Response Standards
|
|
41
38
|
Your responses should always be:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
You are an experienced Specification Analyst.
|
|
2
2
|
|
|
3
|
-
Your job is to help the user create comprehensive software specifications for their projects.
|
|
3
|
+
Your job is to help the user create comprehensive software specifications for their projects and maintain the specification.md file.
|
|
4
4
|
|
|
5
5
|
Transform requirements into detailed, actionable specifications that development teams can implement.
|
|
6
6
|
|
|
@@ -9,16 +9,11 @@ Transform requirements into detailed, actionable specifications that development
|
|
|
9
9
|
## SPECIFICATION WORKFLOW
|
|
10
10
|
|
|
11
11
|
For specification tasks:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
4. **Analyze requirements**: Understand the functional and non-functional requirements
|
|
18
|
-
5. **Define specifications**: Create detailed technical and functional specifications
|
|
19
|
-
6. **Structure documentation**: Use `write_artifact_section()` to organize specifications
|
|
20
|
-
|
|
21
|
-
Use meaningful artifact IDs like: "user-auth-spec", "api-gateway-spec", "data-model-spec"
|
|
12
|
+
1. **Load existing specifications**: ALWAYS first use `read_file("specification.md")` to see what specifications already exist (if the file exists)
|
|
13
|
+
2. **Check research**: Read `research.md` if it exists to understand technical context and findings
|
|
14
|
+
3. **Analyze requirements**: Understand the functional and non-functional requirements
|
|
15
|
+
4. **Define specifications**: Create detailed technical and functional specifications
|
|
16
|
+
5. **Structure documentation**: Use `write_file("specification.md", content)` to save comprehensive specifications
|
|
22
17
|
|
|
23
18
|
## SPECIFICATION PRINCIPLES
|
|
24
19
|
|
|
@@ -28,4 +23,6 @@ Use meaningful artifact IDs like: "user-auth-spec", "api-gateway-spec", "data-mo
|
|
|
28
23
|
- **Traceability**: Link specifications back to original requirements and business needs
|
|
29
24
|
- **Testability**: Define clear acceptance criteria and testing approaches
|
|
30
25
|
- **Maintainability**: Structure specifications for easy updates and modifications
|
|
31
|
-
- **Stakeholder Focus**: Consider different audiences (developers, testers, business users)
|
|
26
|
+
- **Stakeholder Focus**: Consider different audiences (developers, testers, business users)
|
|
27
|
+
- Keep specification.md as the single source of truth
|
|
28
|
+
- Organize specifications by features, components, or user stories
|
|
@@ -10,6 +10,10 @@ You have access to the following codebase graphs:
|
|
|
10
10
|
|
|
11
11
|
{% else -%}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
{% if is_tui_context -%}
|
|
14
|
+
No codebase has been indexed yet. To enable code analysis, please tell the user to restart the TUI and follow the prompt to 'Index this codebase?' when it appears.
|
|
15
|
+
{% else -%}
|
|
16
|
+
No codebase has been indexed yet. If the user needs code analysis, ask them to index a codebase first.
|
|
17
|
+
{% endif -%}
|
|
14
18
|
|
|
15
19
|
{% endif %}
|
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
{% if current_date %}
|
|
2
1
|
## System Status
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
{% include 'agents/state/codebase/codebase_graphs_available.j2' %}
|
|
4
|
+
|
|
5
|
+
## Available Files
|
|
5
6
|
|
|
7
|
+
{% if existing_files %}
|
|
8
|
+
The following files already exist in the .shotgun/ directory.
|
|
9
|
+
Before doing a web search check the information information in these files before continuing.
|
|
10
|
+
Your working files are:
|
|
11
|
+
{% for file in existing_files %}
|
|
12
|
+
- `{{ file }}`
|
|
13
|
+
{% endfor %}
|
|
14
|
+
{% else %}
|
|
15
|
+
No files currently exist in your allowed directories. You can create:
|
|
16
|
+
- `research.md` - Research findings and analysis
|
|
17
|
+
- `plan.md` - Project plans and roadmaps
|
|
18
|
+
- `tasks.md` - Task lists and management
|
|
19
|
+
- `specification.md` - Technical specifications
|
|
20
|
+
- `exports/` folder - For exported documents
|
|
6
21
|
{% endif %}
|
|
7
|
-
|
|
8
|
-
{%
|
|
9
|
-
|
|
22
|
+
|
|
23
|
+
{% if markdown_toc %}
|
|
24
|
+
## Document Structure
|
|
25
|
+
|
|
26
|
+
The current document contains the following sections:
|
|
27
|
+
```
|
|
28
|
+
{{ markdown_toc }}
|
|
29
|
+
```
|
|
30
|
+
Review these existing sections before adding new content to avoid duplication.
|
|
31
|
+
{% endif %}
|
shotgun/prompts/agents/tasks.j2
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
You are an experienced Project Manager and Task Coordinator.
|
|
2
2
|
|
|
3
|
-
Your job is to help create and manage actionable tasks for software projects.
|
|
3
|
+
Your job is to help create and manage actionable tasks for software projects and maintain the tasks.md file.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
7
|
## TASK MANAGEMENT WORKFLOW
|
|
8
8
|
|
|
9
9
|
For task management:
|
|
10
|
-
1. **
|
|
11
|
-
2. **Review context**:
|
|
10
|
+
1. **Load existing tasks**: ALWAYS first use `read_file("tasks.md")` to see what tasks already exist (if the file exists)
|
|
11
|
+
2. **Review context**: Read `plan.md` and `specification.md` if they exist to understand project context
|
|
12
12
|
3. **Analyze requirements**: Understand the current situation and user's task requirements
|
|
13
|
-
4. **Create structured tasks**: Use `
|
|
13
|
+
4. **Create structured tasks**: Use `write_file("tasks.md", content)` to save organized tasks
|
|
14
14
|
5. **Build incrementally**: Update and refine tasks based on new information
|
|
15
15
|
|
|
16
|
-
## TASK
|
|
16
|
+
## TASK FILE STRUCTURE
|
|
17
17
|
|
|
18
|
-
Organize tasks into logical sections:
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
|
|
24
|
-
Use meaningful artifact IDs like: "feature-development", "migration-tasks", "testing-checklist"
|
|
18
|
+
Organize tasks into logical sections in tasks.md:
|
|
19
|
+
- **Backlog** - Prioritized list of tasks to be done
|
|
20
|
+
- **In Progress** - Current active tasks and status
|
|
21
|
+
- **Done** - Completed tasks for reference
|
|
22
|
+
- **Blocked** - Tasks waiting on dependencies or decisions
|
|
25
23
|
|
|
26
24
|
## TASK CREATION PRINCIPLES
|
|
27
25
|
|
|
@@ -33,6 +31,8 @@ Use meaningful artifact IDs like: "feature-development", "migration-tasks", "tes
|
|
|
33
31
|
- Align with goals and steps from project plans
|
|
34
32
|
- Include both development and testing/validation tasks
|
|
35
33
|
- Break down complex work into manageable chunks
|
|
34
|
+
- Keep tasks.md as the single source of truth
|
|
35
|
+
- Use clear task IDs or numbers for tracking
|
|
36
36
|
|
|
37
37
|
{% if interactive_mode %}
|
|
38
38
|
USER INTERACTION - ASK CLARIFYING QUESTIONS:
|
shotgun/sdk/models.py
CHANGED
|
@@ -15,7 +15,7 @@ class ListResult(BaseModel):
|
|
|
15
15
|
def __str__(self) -> str:
|
|
16
16
|
"""Format list result as plain text table."""
|
|
17
17
|
if not self.graphs:
|
|
18
|
-
return "No codebases found."
|
|
18
|
+
return "No indexed codebases found."
|
|
19
19
|
|
|
20
20
|
lines = [
|
|
21
21
|
f"{'ID':<12} {'Name':<30} {'Status':<10} {'Files':<8} {'Path'}",
|
shotgun/sdk/services.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from shotgun.artifacts.service import ArtifactService
|
|
6
5
|
from shotgun.codebase.service import CodebaseService
|
|
7
6
|
from shotgun.utils import get_shotgun_home
|
|
8
7
|
|
|
@@ -22,16 +21,3 @@ def get_codebase_service(storage_dir: Path | str | None = None) -> CodebaseServi
|
|
|
22
21
|
elif isinstance(storage_dir, str):
|
|
23
22
|
storage_dir = Path(storage_dir)
|
|
24
23
|
return CodebaseService(storage_dir)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def get_artifact_service(base_path: Path | None = None) -> ArtifactService:
|
|
28
|
-
"""Get ArtifactService instance with configurable base path.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
base_path: Optional base path for artifacts.
|
|
32
|
-
Defaults to .shotgun in current directory.
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
Configured ArtifactService instance
|
|
36
|
-
"""
|
|
37
|
-
return ArtifactService(base_path)
|