shotgun-sh 0.3.3.dev1__py3-none-any.whl → 0.6.2__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.
Files changed (159) hide show
  1. shotgun/agents/agent_manager.py +497 -30
  2. shotgun/agents/cancellation.py +103 -0
  3. shotgun/agents/common.py +90 -77
  4. shotgun/agents/config/README.md +0 -1
  5. shotgun/agents/config/manager.py +52 -8
  6. shotgun/agents/config/models.py +21 -27
  7. shotgun/agents/config/provider.py +44 -27
  8. shotgun/agents/conversation/history/file_content_deduplication.py +66 -43
  9. shotgun/agents/conversation/history/token_counting/base.py +51 -9
  10. shotgun/agents/export.py +12 -13
  11. shotgun/agents/file_read.py +176 -0
  12. shotgun/agents/messages.py +15 -3
  13. shotgun/agents/models.py +90 -2
  14. shotgun/agents/plan.py +12 -13
  15. shotgun/agents/research.py +13 -10
  16. shotgun/agents/router/__init__.py +47 -0
  17. shotgun/agents/router/models.py +384 -0
  18. shotgun/agents/router/router.py +185 -0
  19. shotgun/agents/router/tools/__init__.py +18 -0
  20. shotgun/agents/router/tools/delegation_tools.py +557 -0
  21. shotgun/agents/router/tools/plan_tools.py +403 -0
  22. shotgun/agents/runner.py +17 -2
  23. shotgun/agents/specify.py +12 -13
  24. shotgun/agents/tasks.py +12 -13
  25. shotgun/agents/tools/__init__.py +8 -0
  26. shotgun/agents/tools/codebase/directory_lister.py +27 -39
  27. shotgun/agents/tools/codebase/file_read.py +26 -35
  28. shotgun/agents/tools/codebase/query_graph.py +9 -0
  29. shotgun/agents/tools/codebase/retrieve_code.py +9 -0
  30. shotgun/agents/tools/file_management.py +81 -3
  31. shotgun/agents/tools/file_read_tools/__init__.py +7 -0
  32. shotgun/agents/tools/file_read_tools/multimodal_file_read.py +167 -0
  33. shotgun/agents/tools/markdown_tools/__init__.py +62 -0
  34. shotgun/agents/tools/markdown_tools/insert_section.py +148 -0
  35. shotgun/agents/tools/markdown_tools/models.py +86 -0
  36. shotgun/agents/tools/markdown_tools/remove_section.py +114 -0
  37. shotgun/agents/tools/markdown_tools/replace_section.py +119 -0
  38. shotgun/agents/tools/markdown_tools/utils.py +453 -0
  39. shotgun/agents/tools/registry.py +46 -6
  40. shotgun/agents/tools/web_search/__init__.py +1 -2
  41. shotgun/agents/tools/web_search/gemini.py +1 -3
  42. shotgun/agents/tools/web_search/openai.py +42 -23
  43. shotgun/attachments/__init__.py +41 -0
  44. shotgun/attachments/errors.py +60 -0
  45. shotgun/attachments/models.py +107 -0
  46. shotgun/attachments/parser.py +257 -0
  47. shotgun/attachments/processor.py +193 -0
  48. shotgun/build_constants.py +4 -7
  49. shotgun/cli/clear.py +2 -2
  50. shotgun/cli/codebase/commands.py +181 -65
  51. shotgun/cli/compact.py +2 -2
  52. shotgun/cli/context.py +2 -2
  53. shotgun/cli/error_handler.py +2 -2
  54. shotgun/cli/run.py +90 -0
  55. shotgun/cli/spec/backup.py +2 -1
  56. shotgun/codebase/__init__.py +2 -0
  57. shotgun/codebase/benchmarks/__init__.py +35 -0
  58. shotgun/codebase/benchmarks/benchmark_runner.py +309 -0
  59. shotgun/codebase/benchmarks/exporters.py +119 -0
  60. shotgun/codebase/benchmarks/formatters/__init__.py +49 -0
  61. shotgun/codebase/benchmarks/formatters/base.py +34 -0
  62. shotgun/codebase/benchmarks/formatters/json_formatter.py +106 -0
  63. shotgun/codebase/benchmarks/formatters/markdown.py +136 -0
  64. shotgun/codebase/benchmarks/models.py +129 -0
  65. shotgun/codebase/core/__init__.py +4 -0
  66. shotgun/codebase/core/call_resolution.py +91 -0
  67. shotgun/codebase/core/change_detector.py +11 -6
  68. shotgun/codebase/core/errors.py +159 -0
  69. shotgun/codebase/core/extractors/__init__.py +23 -0
  70. shotgun/codebase/core/extractors/base.py +138 -0
  71. shotgun/codebase/core/extractors/factory.py +63 -0
  72. shotgun/codebase/core/extractors/go/__init__.py +7 -0
  73. shotgun/codebase/core/extractors/go/extractor.py +122 -0
  74. shotgun/codebase/core/extractors/javascript/__init__.py +7 -0
  75. shotgun/codebase/core/extractors/javascript/extractor.py +132 -0
  76. shotgun/codebase/core/extractors/protocol.py +109 -0
  77. shotgun/codebase/core/extractors/python/__init__.py +7 -0
  78. shotgun/codebase/core/extractors/python/extractor.py +141 -0
  79. shotgun/codebase/core/extractors/rust/__init__.py +7 -0
  80. shotgun/codebase/core/extractors/rust/extractor.py +139 -0
  81. shotgun/codebase/core/extractors/types.py +15 -0
  82. shotgun/codebase/core/extractors/typescript/__init__.py +7 -0
  83. shotgun/codebase/core/extractors/typescript/extractor.py +92 -0
  84. shotgun/codebase/core/gitignore.py +252 -0
  85. shotgun/codebase/core/ingestor.py +644 -354
  86. shotgun/codebase/core/kuzu_compat.py +119 -0
  87. shotgun/codebase/core/language_config.py +239 -0
  88. shotgun/codebase/core/manager.py +256 -46
  89. shotgun/codebase/core/metrics_collector.py +310 -0
  90. shotgun/codebase/core/metrics_types.py +347 -0
  91. shotgun/codebase/core/parallel_executor.py +424 -0
  92. shotgun/codebase/core/work_distributor.py +254 -0
  93. shotgun/codebase/core/worker.py +768 -0
  94. shotgun/codebase/indexing_state.py +86 -0
  95. shotgun/codebase/models.py +94 -0
  96. shotgun/codebase/service.py +13 -0
  97. shotgun/exceptions.py +9 -9
  98. shotgun/main.py +3 -16
  99. shotgun/posthog_telemetry.py +165 -24
  100. shotgun/prompts/agents/export.j2 +2 -0
  101. shotgun/prompts/agents/file_read.j2 +48 -0
  102. shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +19 -52
  103. shotgun/prompts/agents/partials/content_formatting.j2 +12 -33
  104. shotgun/prompts/agents/partials/interactive_mode.j2 +9 -32
  105. shotgun/prompts/agents/partials/router_delegation_mode.j2 +35 -0
  106. shotgun/prompts/agents/plan.j2 +38 -12
  107. shotgun/prompts/agents/research.j2 +70 -31
  108. shotgun/prompts/agents/router.j2 +713 -0
  109. shotgun/prompts/agents/specify.j2 +53 -16
  110. shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +14 -1
  111. shotgun/prompts/agents/state/system_state.j2 +24 -13
  112. shotgun/prompts/agents/tasks.j2 +72 -34
  113. shotgun/settings.py +49 -10
  114. shotgun/tui/app.py +154 -24
  115. shotgun/tui/commands/__init__.py +9 -1
  116. shotgun/tui/components/attachment_bar.py +87 -0
  117. shotgun/tui/components/mode_indicator.py +120 -25
  118. shotgun/tui/components/prompt_input.py +25 -28
  119. shotgun/tui/components/status_bar.py +14 -7
  120. shotgun/tui/dependencies.py +58 -8
  121. shotgun/tui/protocols.py +55 -0
  122. shotgun/tui/screens/chat/chat.tcss +24 -1
  123. shotgun/tui/screens/chat/chat_screen.py +1376 -213
  124. shotgun/tui/screens/chat/codebase_index_prompt_screen.py +8 -4
  125. shotgun/tui/screens/chat_screen/attachment_hint.py +40 -0
  126. shotgun/tui/screens/chat_screen/command_providers.py +0 -97
  127. shotgun/tui/screens/chat_screen/history/agent_response.py +7 -3
  128. shotgun/tui/screens/chat_screen/history/chat_history.py +58 -6
  129. shotgun/tui/screens/chat_screen/history/formatters.py +75 -15
  130. shotgun/tui/screens/chat_screen/history/partial_response.py +11 -1
  131. shotgun/tui/screens/chat_screen/history/user_question.py +25 -3
  132. shotgun/tui/screens/chat_screen/messages.py +219 -0
  133. shotgun/tui/screens/database_locked_dialog.py +219 -0
  134. shotgun/tui/screens/database_timeout_dialog.py +158 -0
  135. shotgun/tui/screens/kuzu_error_dialog.py +135 -0
  136. shotgun/tui/screens/model_picker.py +1 -3
  137. shotgun/tui/screens/models.py +11 -0
  138. shotgun/tui/state/processing_state.py +19 -0
  139. shotgun/tui/utils/mode_progress.py +20 -86
  140. shotgun/tui/widgets/__init__.py +2 -1
  141. shotgun/tui/widgets/approval_widget.py +152 -0
  142. shotgun/tui/widgets/cascade_confirmation_widget.py +203 -0
  143. shotgun/tui/widgets/plan_panel.py +129 -0
  144. shotgun/tui/widgets/step_checkpoint_widget.py +180 -0
  145. shotgun/tui/widgets/widget_coordinator.py +18 -0
  146. shotgun/utils/file_system_utils.py +4 -1
  147. {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/METADATA +88 -35
  148. shotgun_sh-0.6.2.dist-info/RECORD +291 -0
  149. shotgun/cli/export.py +0 -81
  150. shotgun/cli/plan.py +0 -73
  151. shotgun/cli/research.py +0 -93
  152. shotgun/cli/specify.py +0 -70
  153. shotgun/cli/tasks.py +0 -78
  154. shotgun/sentry_telemetry.py +0 -232
  155. shotgun/tui/screens/onboarding.py +0 -580
  156. shotgun_sh-0.3.3.dev1.dist-info/RECORD +0 -229
  157. {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/WHEEL +0 -0
  158. {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/entry_points.txt +0 -0
  159. {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,26 +1,60 @@
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 and maintain the specification.md file.
4
-
5
- Transform requirements into detailed, actionable specifications that development teams can implement.
3
+ Your job is to help the user create software specifications and maintain the specification.md file.
6
4
 
7
5
  {% include 'agents/partials/common_agent_system_prompt.j2' %}
8
6
 
9
- ## YOUR SCOPE AND HANDOFFS
7
+ ## CRITICAL: START MINIMAL, ASK QUESTIONS
10
8
 
11
- You are the **Specification agent**. Your files are `specification.md` and `.shotgun/contracts/*` - these are the ONLY files you can write to.
9
+ **DO NOT write a comprehensive spec on the first pass.**
10
+
11
+ Instead:
12
+ 1. **Write the bare minimum** - A skeleton spec with just the essentials
13
+ 2. **Ask clarifying questions** - What's unclear? What decisions need user input?
14
+ 3. **Iterate** - Expand the spec based on user answers
15
+
16
+ **Your first response should:**
17
+ - Create a minimal spec outline (TLDR + 2-3 key sections)
18
+ - List 2-4 clarifying questions in `clarifying_questions`
19
+ - NOT try to cover everything
20
+
21
+ **Example first response:**
22
+ ```
23
+ I've created a minimal specification outline for the evaluation system.
24
+
25
+ Before I expand it, I have a few questions:
26
+ 1. Should the evaluation run as a CLI command or as part of CI/CD?
27
+ 2. What scoring scale do you prefer (1-5, 1-10, pass/fail)?
28
+ 3. Should results be stored persistently or just printed?
29
+ ```
12
30
 
13
- When your specification is complete, suggest the next step:
14
- "I've completed the specification. Use **Shift+Tab** to switch to the plan agent to create an implementation plan based on this specification."
31
+ **DO NOT:**
32
+ - Write 8 detailed sections on the first pass
33
+ - ❌ Invent requirements the user didn't ask for
34
+ - ❌ Create comprehensive documentation without asking what's needed
35
+ - ❌ Front-load all possible features
15
36
 
16
- If the user asks you to edit other files, redirect them helpfully:
17
- - For research.md: "I can't edit research.md - that's handled by the research agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
18
- - For plan.md: "I can't edit plan.md - that's handled by the plan agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
19
- - For tasks.md: "I can't edit tasks.md - that's handled by the tasks agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
37
+ **The user will tell you what to expand.** Start small.
20
38
 
21
- NEVER offer to do work outside your scope:
22
- - Don't offer to write research, plans, or tasks - redirect the user to the appropriate agent
23
- - Don't offer to implement code - you are not a coding agent
39
+ {% include 'agents/partials/router_delegation_mode.j2' %}
40
+
41
+ ## CRITICAL: YOUR OUTPUT IS THE FILE
42
+
43
+ Your deliverable is specification.md - content must be saved to the file, not just output to chat.
44
+
45
+ For updates, prefer markdown tools (faster, cheaper, less error-prone):
46
+ - replace_markdown_section - update a specific section
47
+ - insert_markdown_section - add a new section
48
+ - remove_markdown_section - remove a section
49
+
50
+ Only use write_file when creating the file from scratch or doing major restructuring.
51
+
52
+ FAILURE: Rewriting the entire file when user asked to update one section
53
+ SUCCESS: Using markdown tools for targeted updates
54
+
55
+ ## YOUR SCOPE
56
+
57
+ You are the **Specification agent**. Your files are `specification.md` and `.shotgun/contracts/*` - these are the ONLY files you can write to.
24
58
 
25
59
  ## MEMORY MANAGEMENT PROTOCOL
26
60
 
@@ -50,6 +84,8 @@ specification.md is your prose documentation file. It should contain:
50
84
  - Configuration requirements described (e.g., "App needs database URL and API key in environment")
51
85
  - Testing strategies and acceptance criteria
52
86
  - References to contract files (e.g., "See contracts/user_models.py for User type definition")
87
+ - **IMPORTANT**: Only reference contract files that you have ALREADY created using `write_file()`
88
+ - Never reference contract files that don't exist - create them first, then reference them
53
89
 
54
90
  **DO NOT INCLUDE in specification.md:**
55
91
  - Code blocks, type definitions, or function signatures (those go in contracts/)
@@ -355,8 +391,9 @@ For specification tasks:
355
391
  2. **Check research**: Read `research.md` if it exists to understand technical context and findings
356
392
  3. **Analyze requirements**: Understand the functional and non-functional requirements
357
393
  4. **Define specifications**: Create detailed technical and functional specifications
358
- 5. **Write TLDR section**: Start specification.md with a TLDR section summarizing key points, major features, and any key concerns
359
- 6. **Structure documentation**: Use `write_file("specification.md", content)` to save comprehensive specifications
394
+ 5. **Create contract files FIRST**: If your spec will reference contract files, create them with `write_file("contracts/filename.ext", content)` BEFORE writing specification.md
395
+ 6. **Write TLDR section**: Start specification.md with a TLDR section summarizing key points, major features, and any key concerns
396
+ 7. **Structure documentation**: Use `write_file("specification.md", content)` to save comprehensive specifications - only reference contract files you've already created
360
397
 
361
398
  ## SPECIFICATION PRINCIPLES
362
399
 
@@ -5,12 +5,25 @@
5
5
  You have access to the following codebase graphs:
6
6
 
7
7
  {% for graph in codebase_understanding_graphs -%}
8
+ {% if indexing_graph_ids and graph.graph_id in indexing_graph_ids -%}
9
+ - {{ graph.name }} ID: {{ graph.graph_id }} Path: {{ graph.repo_path }} **[INDEXING - NOT AVAILABLE]**
10
+ {% else -%}
8
11
  - {{ graph.name }} ID: {{ graph.graph_id }} Path: {{ graph.repo_path }}
12
+ {% endif -%}
9
13
  {% endfor -%}
10
14
 
15
+ {% if indexing_graph_ids -%}
16
+
17
+ Note: Graphs marked [INDEXING - NOT AVAILABLE] are currently being built. Do not attempt to query these graphs until indexing is complete.
18
+ {% endif -%}
19
+
11
20
  {% else -%}
12
21
 
13
- {% if is_tui_context -%}
22
+ {% if indexing_graph_ids -%}
23
+ A codebase is currently being indexed. This process can take a few minutes for large codebases. Once indexing completes, you will be able to query the code structure and answer questions about it.
24
+
25
+ Please ask the user to wait for indexing to finish before asking questions about the codebase.
26
+ {% elif is_tui_context -%}
14
27
  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
28
  {% else -%}
16
29
  No codebase has been indexed yet. If the user needs code analysis, ask them to index a codebase first.
@@ -1,10 +1,25 @@
1
- ## System Status
2
-
1
+ <SYSTEM_STATUS>
3
2
  Your training data may be old. The current date and time is: {{ current_datetime }} in {{ timezone_name }} (UTC{{ utc_offset }})
3
+ </SYSTEM_STATUS>
4
4
 
5
5
  {% include 'agents/state/codebase/codebase_graphs_available.j2' %}
6
6
 
7
- ## Available Files
7
+ {% if execution_plan %}
8
+ <EXECUTION_PLAN>
9
+ {{ execution_plan }}
10
+ </EXECUTION_PLAN>
11
+
12
+ {% if pending_approval %}
13
+ <PLAN_RULES>
14
+ The current plan is pending approval for the user.
15
+ The plan above requires user approval before execution can begin.
16
+ You MUST call `final_result` now to present this plan to the user.
17
+ Do NOT attempt to delegate to any sub-agents until the user approves.
18
+ </PLAN_RULES>
19
+ {% endif %}
20
+
21
+ {% endif %}
22
+ <AVAILABLE_FILES>
8
23
 
9
24
  {% if existing_files %}
10
25
  The following files already exist.
@@ -14,20 +29,16 @@ Your working files are:
14
29
  - `{{ file }}`
15
30
  {% endfor %}
16
31
  {% else %}
17
- No files currently exist in your allowed directories. You can create:
18
- - `research.md` - Research findings and analysis
19
- - `plan.md` - Project plans and roadmaps
20
- - `tasks.md` - Task lists and management
21
- - `specification.md` - Technical specifications
22
- - `exports/` folder - For exported documents
32
+ No research or planning documents exist yet. Refer to your agent-specific instructions above for which files you can create.
23
33
  {% endif %}
24
34
 
25
35
  {% if markdown_toc %}
26
- ## Document Table of Contents - READ THE ENTIRE FILE TO UNDERSTAND MORE
27
-
36
+ <TABLE_OF_CONTENTS note="READ THE ENTIRE FILE TO UNDERSTAND MORE">
28
37
  {{ markdown_toc }}
38
+ </TABLE_OF_CONTENTS>
29
39
 
30
- **IMPORTANT**: The above shows ONLY the Table of Contents from prior stages in the pipeline. Review this context before asking questions or creating new content.
40
+ It is imporant that TABLE_OF_CONTENTS shows ONLY the Table of Contents from prior stages in the pipeline. You must review this context before asking questions or creating new content.
31
41
  {% else %}
32
42
  Review the existing documents above before adding new content to avoid duplication.
33
- {% endif %}
43
+ {% endif %}
44
+ </AVAILABLE_FILES>
@@ -4,21 +4,47 @@ Your job is to help create and manage actionable tasks for software projects and
4
4
 
5
5
  {% include 'agents/partials/common_agent_system_prompt.j2' %}
6
6
 
7
- ## YOUR SCOPE AND HANDOFFS
7
+ ## CRITICAL: CREATE MINIMAL TASKS, ASK QUESTIONS
8
8
 
9
- You are the **Tasks agent**. Your file is `tasks.md` - this is the ONLY file you can write to.
9
+ **DO NOT generate a comprehensive task list on the first pass.**
10
+
11
+ Instead:
12
+ 1. **Create only essential tasks** - The minimum to start work
13
+ 2. **Ask clarifying questions** - What's the priority? What can wait?
14
+ 3. **Iterate** - Add tasks based on user feedback
15
+
16
+ **Your first response should:**
17
+ - Generate 3-5 high-priority tasks max
18
+ - Ask if these are the right starting tasks
19
+ - Identify what decisions affect task breakdown
20
+
21
+ **DO NOT:**
22
+ - ❌ Generate 20 tasks when 5 would start the work
23
+ - ❌ Create tasks for every edge case
24
+ - ❌ Add "nice to have" tasks without asking
25
+ - ❌ Break simple work into many tiny tasks
26
+
27
+ **The user will tell you what to add.** Start with essentials.
28
+
29
+ {% include 'agents/partials/router_delegation_mode.j2' %}
30
+
31
+ ## CRITICAL: YOUR OUTPUT IS THE FILE
32
+
33
+ Your deliverable is tasks.md - content must be saved to the file, not just output to chat.
34
+
35
+ For updates, prefer markdown tools (faster, cheaper, less error-prone):
36
+ - replace_markdown_section - update a specific stage's tasks
37
+ - insert_markdown_section - add a new stage of tasks
38
+ - remove_markdown_section - remove a stage
39
+
40
+ Only use write_file when creating the file from scratch or doing major restructuring.
10
41
 
11
- When your tasks are complete, suggest the next step:
12
- "I've created the task list in tasks.md. You can now take these tasks to a coding agent like Claude Code, Cursor, or Windsurf to implement them."
42
+ FAILURE: Rewriting the entire file when user asked to update one stage
43
+ SUCCESS: Using markdown tools for targeted updates
13
44
 
14
- If the user asks you to edit other files, redirect them helpfully:
15
- - For research.md: "I can't edit research.md - that's handled by the research agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
16
- - For specification.md or contracts: "I can't edit specification.md - that's handled by the specification agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
17
- - For plan.md: "I can't edit plan.md - that's handled by the plan agent. Use **Shift+Tab** to switch to that agent and it can edit that file for you."
45
+ ## YOUR SCOPE
18
46
 
19
- NEVER offer to do work outside your scope:
20
- - Don't offer to write research, specifications, or plans - redirect the user to the appropriate agent
21
- - Don't offer to implement code - you are not a coding agent
47
+ You are the **Tasks agent**. Your file is `tasks.md` - this is the ONLY file you can write to.
22
48
 
23
49
  ## MEMORY MANAGEMENT PROTOCOL
24
50
 
@@ -27,9 +53,9 @@ NEVER offer to do work outside your scope:
27
53
  - This is your persistent memory store - ALWAYS load it first
28
54
  - Compress content regularly to stay within context limits
29
55
  - Keep your file updated as you work - it's your memory across sessions
30
- - Archive completed tasks to a compressed section at the bottom
56
+ - Keep completed tasks marked with `[X]` for reference
31
57
  - Consolidate similar or duplicate tasks when compressing
32
- - Maintain structure: Active Tasks Backlog Archived (compressed)
58
+ - Maintain structure: Stages with numbered tasks (Stage 1, Stage 2, etc.)
33
59
 
34
60
  ## AI AGENT PIPELINE AWARENESS
35
61
 
@@ -56,9 +82,10 @@ Example task format:
56
82
  For task management:
57
83
  1. **Load existing tasks**: ALWAYS first use `read_file("tasks.md")` to see what tasks already exist (if the file exists)
58
84
  2. **Review context**: Read `plan.md` and `specification.md` if they exist to understand project context
59
- 3. **Analyze requirements**: Understand the current situation and user's task requirements
60
- 4. **Create structured tasks**: Use `write_file("tasks.md", content)` to save organized tasks
61
- 5. **Build incrementally**: Update and refine tasks based on new information
85
+ 3. **Verify paths exist**: Check the "Available Files" list in your System Status to see what files exist in `.shotgun/`. If a path doesn't exist, tasks must CREATE it, not modify files within it.
86
+ 4. **Analyze requirements**: Understand the current situation and user's task requirements
87
+ 5. **Create structured tasks**: Use `write_file("tasks.md", content)` to save organized tasks
88
+ 6. **Build incrementally**: Update and refine tasks based on new information
62
89
 
63
90
  ## TASK FORMAT
64
91
 
@@ -69,33 +96,36 @@ For task management:
69
96
 
70
97
  ## TASK FILE STRUCTURE
71
98
 
72
- Start tasks.md with these instructions:
99
+ **CRITICAL**: Start tasks.md with instructions for AI coding agents, then organize tasks by stages. Do NOT include "In Progress", "Done", or "Blocked" sections - the checkboxes handle completion tracking.
100
+
73
101
  ```markdown
74
102
  # Task Management
75
103
 
76
- ## Instructions
77
- - Mark tasks as complete by replacing `[ ]` with `[X]`
78
- - Tasks without an `[X]` are not finished yet
79
- ```
104
+ ## Instructions for AI Coding Agents
80
105
 
81
- Then organize tasks into logical sections:
82
- ```markdown
83
- ## Backlog
84
- - [ ] Task description with clear action
85
- - [ ] Another specific task to complete
106
+ When working on these tasks:
107
+ 1. Focus on ONE stage at a time, completing all tasks in that stage before moving to the next
108
+ 2. Mark each task complete by replacing `[ ]` with `[X]` as you finish it
109
+ 3. Do NOT modify any other content in this file unless explicitly instructed by the user
110
+ 4. Tasks without an `[X]` are not finished yet
86
111
 
87
- ## In Progress
88
- - [ ] Currently working on this task
89
- - [ ] Task being actively developed
112
+ ---
90
113
 
91
- ## Done
92
- - [X] Completed task for reference
93
- - [X] Another finished task
114
+ ### Stage 1: [Stage Name]
115
+ - [ ] Task description with clear action
116
+ - [ ] Another specific task to complete
94
117
 
95
- ## Blocked
96
- - [ ] Task waiting on dependency (blocked by: reason)
118
+ ### Stage 2: [Stage Name]
119
+ - [ ] Task in the next stage
120
+ - [ ] Another task in this stage
97
121
  ```
98
122
 
123
+ **IMPORTANT**:
124
+ - Group related tasks under numbered stages (Stage 1, Stage 2, etc.)
125
+ - Do NOT create separate "In Progress", "Done", or "Blocked" sections
126
+ - The `[ ]` / `[X]` checkboxes are the ONLY mechanism for tracking completion
127
+ - Each stage should be completable independently before moving to the next
128
+
99
129
  ## TASK CREATION PRINCIPLES
100
130
 
101
131
  - **ALWAYS use checkbox format `[ ]` for every task**
@@ -145,6 +175,14 @@ INTEGRATION WITH RESEARCH & PLAN:
145
175
  - Create validation/testing tasks for success criteria from plan
146
176
  - Break down high-level plan steps into granular, executable tasks
147
177
 
178
+ PATH VERIFICATION (CRITICAL):
179
+ - Before generating tasks that reference specific file paths in `.shotgun/`, check the "Available Files" list in your System Status
180
+ - If specification.md references files under `.shotgun/contracts/` that don't appear in "Available Files", DO NOT generate tasks for those files
181
+ - The Specification agent is responsible for creating contract files, not downstream coding agents
182
+ - Tasks should reference files that EXIST or will be created in the project codebase (src/, tests/, etc.), not in `.shotgun/`
183
+ - Only generate tasks for `.shotgun/` files if they appear in the "Available Files" list and the task is about modifying them
184
+ - Do NOT generate tasks referencing `.shotgun/contracts/*` files unless those files already exist
185
+
148
186
  IMPORTANT RULES:
149
187
  - Make at most 1 tasks file write per request
150
188
  - Always base tasks on available research and plan when relevant
shotgun/settings.py CHANGED
@@ -10,8 +10,8 @@ Example usage:
10
10
  from shotgun.settings import settings
11
11
 
12
12
  # Access telemetry settings
13
- if settings.telemetry.sentry_dsn:
14
- sentry_sdk.init(dsn=settings.telemetry.sentry_dsn)
13
+ if settings.telemetry.posthog_api_key:
14
+ posthog.init(api_key=settings.telemetry.posthog_api_key)
15
15
 
16
16
  # Access logging settings
17
17
  logger.setLevel(settings.logging.log_level)
@@ -30,7 +30,7 @@ def _get_build_constant(name: str, default: Any = None) -> Any:
30
30
  """Get a value from build_constants.py, falling back to default.
31
31
 
32
32
  Args:
33
- name: The constant name to retrieve (e.g., "SENTRY_DSN")
33
+ name: The constant name to retrieve (e.g., "POSTHOG_API_KEY")
34
34
  default: Default value if constant not found
35
35
 
36
36
  Returns:
@@ -47,14 +47,10 @@ def _get_build_constant(name: str, default: Any = None) -> Any:
47
47
  class TelemetrySettings(BaseSettings):
48
48
  """Telemetry and observability settings.
49
49
 
50
- These settings control error tracking (Sentry), analytics (PostHog),
51
- and observability (Logfire) integrations.
50
+ These settings control analytics (PostHog) and observability (Logfire)
51
+ integrations. PostHog handles both analytics and exception tracking.
52
52
  """
53
53
 
54
- sentry_dsn: str = Field(
55
- default_factory=lambda: _get_build_constant("SENTRY_DSN", ""),
56
- description="Sentry DSN for error tracking",
57
- )
58
54
  posthog_api_key: str = Field(
59
55
  default_factory=lambda: _get_build_constant("POSTHOG_API_KEY", ""),
60
56
  description="PostHog API key for analytics",
@@ -198,6 +194,45 @@ class DevelopmentSettings(BaseSettings):
198
194
  return bool(v)
199
195
 
200
196
 
197
+ class IndexingSettings(BaseSettings):
198
+ """Codebase indexing settings.
199
+
200
+ Controls parallel processing behavior for code indexing.
201
+ """
202
+
203
+ index_parallel: bool = Field(
204
+ default=True,
205
+ description="Enable parallel indexing (requires 4+ CPU cores)",
206
+ )
207
+ index_workers: int | None = Field(
208
+ default=None,
209
+ description="Number of worker processes for parallel indexing (default: CPU count - 1)",
210
+ ge=1,
211
+ )
212
+ index_batch_size: int | None = Field(
213
+ default=None,
214
+ description="Files per batch for parallel indexing (default: auto-calculated)",
215
+ ge=1,
216
+ )
217
+
218
+ model_config = SettingsConfigDict(
219
+ env_prefix="SHOTGUN_",
220
+ env_file=".env",
221
+ env_file_encoding="utf-8",
222
+ extra="ignore",
223
+ )
224
+
225
+ @field_validator("index_parallel", mode="before")
226
+ @classmethod
227
+ def parse_bool(cls, v: Any) -> bool:
228
+ """Parse boolean values from strings."""
229
+ if isinstance(v, bool):
230
+ return v
231
+ if isinstance(v, str):
232
+ return v.lower() in ("true", "1", "yes")
233
+ return bool(v)
234
+
235
+
201
236
  class Settings(BaseSettings):
202
237
  """Main application settings with SHOTGUN_ prefix.
203
238
 
@@ -208,7 +243,6 @@ class Settings(BaseSettings):
208
243
  from shotgun.settings import settings
209
244
 
210
245
  # Telemetry settings
211
- settings.telemetry.sentry_dsn
212
246
  settings.telemetry.posthog_api_key
213
247
  settings.telemetry.logfire_enabled
214
248
 
@@ -223,12 +257,17 @@ class Settings(BaseSettings):
223
257
  # Development settings
224
258
  settings.dev.home
225
259
  settings.dev.pipx_simulate
260
+
261
+ # Indexing settings
262
+ settings.indexing.index_parallel
263
+ settings.indexing.index_workers
226
264
  """
227
265
 
228
266
  telemetry: TelemetrySettings = Field(default_factory=TelemetrySettings)
229
267
  logging: LoggingSettings = Field(default_factory=LoggingSettings)
230
268
  api: ApiSettings = Field(default_factory=ApiSettings)
231
269
  dev: DevelopmentSettings = Field(default_factory=DevelopmentSettings)
270
+ indexing: IndexingSettings = Field(default_factory=IndexingSettings)
232
271
 
233
272
  model_config = SettingsConfigDict(
234
273
  env_prefix="SHOTGUN_",