dialectic 0.1.0

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 (119) hide show
  1. package/.cursor/commands/setup-test.mdc +175 -0
  2. package/.cursor/rules/basic-code-cleanup.mdc +1110 -0
  3. package/.cursor/rules/riper5.mdc +96 -0
  4. package/.env.example +6 -0
  5. package/AGENTS.md +1052 -0
  6. package/LICENSE +21 -0
  7. package/README.md +93 -0
  8. package/WARP.md +113 -0
  9. package/dialectic-1.0.0.tgz +0 -0
  10. package/dialectic.js +10 -0
  11. package/docs/commands.md +375 -0
  12. package/docs/configuration.md +882 -0
  13. package/docs/context_summarization.md +1023 -0
  14. package/docs/debate_flow.md +1127 -0
  15. package/docs/eval_flow.md +795 -0
  16. package/docs/evaluator.md +141 -0
  17. package/examples/debate-config-openrouter.json +48 -0
  18. package/examples/debate_config1.json +48 -0
  19. package/examples/eval/eval1/eval_config1.json +13 -0
  20. package/examples/eval/eval1/result1.json +62 -0
  21. package/examples/eval/eval1/result2.json +97 -0
  22. package/examples/eval_summary_format.md +11 -0
  23. package/examples/example3/debate-config.json +64 -0
  24. package/examples/example3/eval_config2.json +25 -0
  25. package/examples/example3/problem.md +17 -0
  26. package/examples/example3/rounds_test/eval_run.sh +16 -0
  27. package/examples/example3/rounds_test/run_test.sh +16 -0
  28. package/examples/kata1/architect-only-solution_2-rounds.json +121 -0
  29. package/examples/kata1/architect-perf-solution_2-rounds.json +234 -0
  30. package/examples/kata1/debate-config-kata1.json +54 -0
  31. package/examples/kata1/eval_architect-only_2-rounds.json +97 -0
  32. package/examples/kata1/eval_architect-perf_2-rounds.json +97 -0
  33. package/examples/kata1/kata1-report.md +12224 -0
  34. package/examples/kata1/kata1-report_temps-01_01_01_07.md +2451 -0
  35. package/examples/kata1/kata1.md +5 -0
  36. package/examples/kata1/meta.txt +1 -0
  37. package/examples/kata2/debate-config.json +54 -0
  38. package/examples/kata2/eval_config1.json +21 -0
  39. package/examples/kata2/eval_config2.json +25 -0
  40. package/examples/kata2/kata2.md +5 -0
  41. package/examples/kata2/only_architect/debate-config.json +45 -0
  42. package/examples/kata2/only_architect/eval_run.sh +11 -0
  43. package/examples/kata2/only_architect/run_test.sh +5 -0
  44. package/examples/kata2/rounds_test/eval_run.sh +11 -0
  45. package/examples/kata2/rounds_test/run_test.sh +5 -0
  46. package/examples/kata2/summary_length_test/eval_run.sh +11 -0
  47. package/examples/kata2/summary_length_test/eval_run_w_clarify.sh +7 -0
  48. package/examples/kata2/summary_length_test/run_test.sh +5 -0
  49. package/examples/task-queue/debate-config.json +76 -0
  50. package/examples/task-queue/debate_report.md +566 -0
  51. package/examples/task-queue/task-queue-system.md +25 -0
  52. package/jest.config.ts +13 -0
  53. package/multi_agent_debate_spec.md +2980 -0
  54. package/package.json +38 -0
  55. package/sanity-check-problem.txt +9 -0
  56. package/src/agents/prompts/architect-prompts.ts +203 -0
  57. package/src/agents/prompts/generalist-prompts.ts +157 -0
  58. package/src/agents/prompts/index.ts +41 -0
  59. package/src/agents/prompts/judge-prompts.ts +19 -0
  60. package/src/agents/prompts/kiss-prompts.ts +230 -0
  61. package/src/agents/prompts/performance-prompts.ts +142 -0
  62. package/src/agents/prompts/prompt-types.ts +68 -0
  63. package/src/agents/prompts/security-prompts.ts +149 -0
  64. package/src/agents/prompts/shared.ts +144 -0
  65. package/src/agents/prompts/testing-prompts.ts +149 -0
  66. package/src/agents/role-based-agent.ts +386 -0
  67. package/src/cli/commands/debate.ts +761 -0
  68. package/src/cli/commands/eval.ts +475 -0
  69. package/src/cli/commands/report.ts +265 -0
  70. package/src/cli/index.ts +79 -0
  71. package/src/core/agent.ts +198 -0
  72. package/src/core/clarifications.ts +34 -0
  73. package/src/core/judge.ts +257 -0
  74. package/src/core/orchestrator.ts +432 -0
  75. package/src/core/state-manager.ts +322 -0
  76. package/src/eval/evaluator-agent.ts +130 -0
  77. package/src/eval/prompts/system.md +41 -0
  78. package/src/eval/prompts/user.md +64 -0
  79. package/src/providers/llm-provider.ts +25 -0
  80. package/src/providers/openai-provider.ts +84 -0
  81. package/src/providers/openrouter-provider.ts +122 -0
  82. package/src/providers/provider-factory.ts +64 -0
  83. package/src/types/agent.types.ts +141 -0
  84. package/src/types/config.types.ts +47 -0
  85. package/src/types/debate.types.ts +237 -0
  86. package/src/types/eval.types.ts +85 -0
  87. package/src/utils/common.ts +104 -0
  88. package/src/utils/context-formatter.ts +102 -0
  89. package/src/utils/context-summarizer.ts +143 -0
  90. package/src/utils/env-loader.ts +46 -0
  91. package/src/utils/exit-codes.ts +5 -0
  92. package/src/utils/id.ts +11 -0
  93. package/src/utils/logger.ts +48 -0
  94. package/src/utils/paths.ts +10 -0
  95. package/src/utils/progress-ui.ts +313 -0
  96. package/src/utils/prompt-loader.ts +79 -0
  97. package/src/utils/report-generator.ts +301 -0
  98. package/tests/clarifications.spec.ts +128 -0
  99. package/tests/cli.debate.spec.ts +144 -0
  100. package/tests/config-loading.spec.ts +206 -0
  101. package/tests/context-summarizer.spec.ts +131 -0
  102. package/tests/debate-config-custom.json +38 -0
  103. package/tests/env-loader.spec.ts +149 -0
  104. package/tests/eval.command.spec.ts +1191 -0
  105. package/tests/logger.spec.ts +19 -0
  106. package/tests/openai-provider.spec.ts +26 -0
  107. package/tests/openrouter-provider.spec.ts +279 -0
  108. package/tests/orchestrator-summary.spec.ts +386 -0
  109. package/tests/orchestrator.spec.ts +207 -0
  110. package/tests/prompt-loader.spec.ts +52 -0
  111. package/tests/prompts/architect.md +16 -0
  112. package/tests/provider-factory.spec.ts +150 -0
  113. package/tests/report.command.spec.ts +546 -0
  114. package/tests/role-based-agent-summary.spec.ts +476 -0
  115. package/tests/security-agent.spec.ts +221 -0
  116. package/tests/shared-prompts.spec.ts +318 -0
  117. package/tests/state-manager.spec.ts +251 -0
  118. package/tests/summary-prompts.spec.ts +153 -0
  119. package/tsconfig.json +49 -0
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "dialectic",
3
+ "version": "0.1.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "dialectic": "./dialectic.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "ts-node src/cli/index.ts",
12
+ "test": "jest",
13
+ "test:watch": "jest --watch",
14
+ "test:coverage": "jest --coverage",
15
+ "prepare": "npm run build"
16
+ },
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "MIT",
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "dependencies": {
24
+ "chalk": "^4.1.2",
25
+ "commander": "^11.0.0",
26
+ "dotenv": "^16.3.1",
27
+ "openai": "^4.52.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/jest": "^29.5.12",
31
+ "@types/node": "^24.6.2",
32
+ "jest": "^29.7.0",
33
+ "nodemon": "^3.1.10",
34
+ "ts-jest": "^29.2.5",
35
+ "ts-node": "^10.9.2",
36
+ "typescript": "^5.9.3"
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ Design a simple in-memory cache system with the following requirements:
2
+
3
+ 1. Store key-value pairs where keys are strings and values can be any object
4
+ 2. Support TTL (time-to-live) expiration for cache entries
5
+ 3. Implement LRU (Least Recently Used) eviction policy when cache reaches capacity
6
+ 4. Provide thread-safe operations for concurrent access
7
+ 5. Include basic metrics like hit rate and cache size
8
+
9
+ The system should be lightweight and suitable for a web application handling moderate traffic.
@@ -0,0 +1,203 @@
1
+ import { RolePrompts } from './prompt-types';
2
+ import { prependContext } from '../../utils/context-formatter';
3
+ import { appendSharedInstructions, INSTRUCTION_TYPES } from './shared';
4
+ import type { DebateContext } from '../../types/debate.types';
5
+
6
+
7
+ const BASE_SYSTEM_PROMPT = `You are an expert software architect specializing in distributed systems and scalable architecture design.
8
+
9
+ Your focus: scalability, performance, component boundaries, interfaces, architectural patterns, data flow, state management, and operational concerns.
10
+
11
+ When proposing solutions:
12
+ - Begin with the high-level architecture and rationale
13
+ - Identify main components and their responsibilities
14
+ - Describe communication and data flow
15
+ - Highlight scalability, reliability, and observability considerations
16
+
17
+ When critiquing:
18
+ - Identify architectural bottlenecks or weaknesses
19
+ - Assess clarity of component boundaries and data ownership
20
+ - Examine scalability, fault tolerance, and operational complexity
21
+ - Suggest concrete, principle-based improvements
22
+ `;
23
+
24
+ /**
25
+ * Prompts for the Architect role, specializing in software architecture and system design.
26
+ *
27
+ * The architect focuses on scalability, component boundaries, architectural patterns,
28
+ * data flow, and operational concerns.
29
+ */
30
+ export const architectPrompts: RolePrompts = {
31
+ systemPrompt: appendSharedInstructions(BASE_SYSTEM_PROMPT, INSTRUCTION_TYPES.SYSTEM),
32
+
33
+ proposePrompt: (problem: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
34
+ const basePrompt = `Problem to solve:
35
+ ${problem}
36
+
37
+ As an architect, propose a comprehensive solution including approach, key components, challenges, and justification.
38
+
39
+ Use the following Markdown structure in your response:
40
+ ### Architecture Overview
41
+ (Provide a 3–5 sentence summary of the overall architecture, guiding principles, and key design intent.)
42
+
43
+ ### Key Components and Responsibilities
44
+ (List major components/services and describe each one’s main role.)
45
+
46
+ ### Data Flow and Interactions
47
+ (Describe how data and control flow between components. Mention APIs, events, or message flows if relevant.)
48
+
49
+ ### Architectural Patterns and Rationale
50
+ (State which design or architectural patterns are used — e.g., microservices, CQRS, event-driven — and justify why they fit this problem.)
51
+
52
+ ### Non-Functional Considerations
53
+ #### Scalability and Performance
54
+ (Discuss scaling strategy, bottleneck mitigation, and performance aspects.)
55
+ #### Security
56
+ (Outline authentication, authorization, and data protection strategies.)
57
+ #### Maintainability and Evolvability
58
+ (Describe modularity, extensibility, and how the design supports change.)
59
+ #### Operational Concerns
60
+ (Deployment, monitoring, resilience, observability.)
61
+ #### Regulatory/Compliance (if applicable)
62
+ (Discuss awareness of relevant compliance concerns, or note "Not applicable.")
63
+
64
+ ### Key Challenges and Trade-offs
65
+ (Identify main architectural trade-offs, risks, or limitations.)
66
+
67
+ ### Optional: Technology Choices
68
+ (If specific technologies clarify the design intent, list them briefly here.)
69
+
70
+ ---
71
+
72
+ Respond **only** in this structured format.
73
+ Avoid generalities — make concrete architectural claims and reasoning.
74
+ `;
75
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
76
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.PROPOSAL);
77
+ },
78
+
79
+ critiquePrompt: (proposalContent: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
80
+ const basePrompt = `Review this proposal from an architectural perspective.
81
+
82
+ Proposal:
83
+ ${proposalContent}
84
+
85
+ Use the following Markdown structure for your critique:
86
+
87
+ ### Architectural Strengths
88
+ (List the strongest aspects — e.g., clear component boundaries, good scalability strategy, sound data design.)
89
+
90
+ ### Weaknesses and Risks
91
+ (Identify architectural issues: missing components, unclear data ownership, poor fault tolerance, coupling issues, etc.)
92
+
93
+ ### Improvement Suggestions
94
+ (Suggest specific, actionable architectural changes or refinements.)
95
+
96
+ ### Critical Issues
97
+ (Highlight any major flaws that could cause operational, performance, or correctness problems if not addressed.)
98
+
99
+ ### Overall Assessment
100
+ (Brief summary judgment: Is the design sound overall? Why or why not?)
101
+
102
+ ---
103
+
104
+ Your tone should be professional and evidence-based.
105
+ Avoid vague comments — reason from architectural principles.
106
+ `;
107
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
108
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.CRITIQUE);
109
+ },
110
+
111
+ refinePrompt: (originalContent: string, critiquesText: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
112
+ const basePrompt = `Original proposal:
113
+ ${originalContent}
114
+
115
+ Critiques:
116
+ ${critiquesText}
117
+
118
+ Refine your proposal by addressing valid concerns, incorporating good suggestions, and strengthening the solution.
119
+
120
+ Refine the original design using the following Markdown structure in your response:
121
+
122
+ ### Updated Architecture Overview
123
+ (Summarize how the design has evolved, referencing key feedback addressed.)
124
+
125
+ ### Revised Components and Changes
126
+ (Describe specific improvements or restructuring made to components.)
127
+
128
+ ### Addressed Issues
129
+ (List the critiques or concerns that have been directly resolved.)
130
+
131
+ ### Remaining Open Questions
132
+ (If some critiques were invalid, unclear, or intentionally left unaddressed, explain why.)
133
+
134
+ ### Final Architectural Summary
135
+ (Provide the improved architecture in concise form, integrating new insights while maintaining coherence.)
136
+
137
+ ---
138
+
139
+ The goal is to produce a **stronger, more defensible design** — not just edits.
140
+ Be explicit about what changed and why.
141
+ `
142
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
143
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.REFINEMENT);
144
+ },
145
+
146
+ summarizePrompt: (content: string, maxLength: number) => {
147
+ const basePrompt = `You are summarizing the debate history from an architectural perspective. Focus on key architectural decisions, component designs, scalability concerns, and design patterns that have been discussed.
148
+
149
+ Debate history to summarize:
150
+ ${content}
151
+
152
+ Create a concise summary (maximum ${maxLength} characters) that preserves the most important architectural insights, decisions, and open questions. Focus on information that will be useful for future rounds of the debate.
153
+
154
+ ### Key Architectural Decisions
155
+ (List the most significant decisions made so far — component structure, communication patterns, technology direction.)
156
+
157
+ ### Major Trade-offs Discussed
158
+ (Summarize debates around scalability, consistency, or performance vs. complexity.)
159
+
160
+ ### Unresolved Questions or Conflicts
161
+ (Identify points that remain debated or need further exploration.)
162
+
163
+ ### Emerging Consensus
164
+ (Briefly describe what the participants seem to agree upon.)
165
+
166
+ ### Lessons Learned or Insights
167
+ (Capture meta-level architectural reasoning or patterns discovered.)
168
+
169
+ ---
170
+
171
+ Keep it concise, factual, and focused on architectural reasoning.
172
+ `;
173
+ return appendSharedInstructions(basePrompt, INSTRUCTION_TYPES.SUMMARIZATION);
174
+ },
175
+
176
+ clarifyPrompt: (problem: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
177
+ const basePrompt = `You are preparing clarifying questions from an **architectural perspective**.
178
+
179
+ Problem to clarify:
180
+ ${problem}
181
+
182
+ Your goal is to identify missing, ambiguous, or underspecified information that would significantly influence architectural decisions.
183
+ Focus on questions that would meaningfully improve the quality of a future software architecture proposal.
184
+
185
+ When thinking about what to ask, consider:
186
+ - Scalability (e.g., expected load, traffic patterns, horizontal vs. vertical scaling)
187
+ - Performance (latency, throughput, resource constraints)
188
+ - Component boundaries and interfaces (APIs, responsibilities, integrations)
189
+ - Architectural patterns and styles (event-driven, layered, microservices, etc.)
190
+ - Data flow and state management (data ownership, consistency model, persistence)
191
+ - Operational and deployment concerns (availability, fault tolerance, monitoring)
192
+ - Security or compliance constraints (authentication, data protection, privacy)
193
+
194
+ Guidelines:
195
+ - Prefer **high-signal, clarifying questions** that would directly impact architectural direction.
196
+ - Avoid trivial or redundant questions (e.g., restating information already in the problem).
197
+ - If the problem is already well-specified, you may return no questions.
198
+ - Each question must be **concise and independent** — do not bundle multiple subquestions.`;
199
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
200
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.CLARIFICATION);
201
+ },
202
+ };
203
+
@@ -0,0 +1,157 @@
1
+ import { RolePrompts } from './prompt-types';
2
+ import { prependContext } from '../../utils/context-formatter';
3
+ import { appendSharedInstructions, INSTRUCTION_TYPES } from './shared';
4
+ import type { DebateContext } from '../../types/debate.types';
5
+
6
+ /**
7
+ * Prompts for the Generalist role, providing balanced multi-perspective analysis.
8
+ *
9
+ * The generalist focuses on overall solution quality, balancing trade-offs across
10
+ * different concerns (architecture, performance, security, testing).
11
+ */
12
+ export const generalistPrompts: RolePrompts = {
13
+ systemPrompt: appendSharedInstructions(`You are an expert **software systems generalist**, experienced in integrating architectural, performance, security, and testing perspectives into cohesive system designs.
14
+
15
+ Your focus areas:
16
+ - Holistic systems reasoning and trade-off analysis
17
+ - Balancing functionality, scalability, and maintainability
18
+ - Evaluating design coherence and integration of specialist concerns
19
+ - Identifying conflicts between architectural priorities
20
+ - Synthesizing complex inputs into consistent and feasible designs
21
+
22
+ When proposing solutions:
23
+ - Integrate ideas across multiple domains (architecture, performance, security, testability)
24
+ - Explain how components, flows, and responsibilities align as a unified system
25
+ - Highlight trade-offs explicitly and justify them
26
+
27
+ When critiquing:
28
+ - Evaluate overall design coherence and consistency between subsystems
29
+ - Identify missing integration points or contradictions between specialist recommendations
30
+ - Provide balanced, reasoned guidance that reconciles differing perspectives`, INSTRUCTION_TYPES.SYSTEM),
31
+
32
+ proposePrompt: (problem: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
33
+ const basePrompt = `Problem to solve:
34
+ ${problem}
35
+
36
+ As a generalist, propose a cohesive solution that balances architecture, performance, security, and testability concerns.
37
+
38
+ Use this structure:
39
+ ## Overall Approach
40
+ Summarize the high-level concept and rationale.
41
+
42
+ ## Key Components & Interactions
43
+ Outline main system components and their relationships.
44
+
45
+ ## Cross-Domain Integration
46
+ Explain how architectural, performance, security, and testability requirements are balanced.
47
+
48
+ ## Trade-offs & Conflicts
49
+ Discuss trade-offs made between conflicting design goals.
50
+
51
+ ## Risks & Mitigation
52
+ Identify key risks (technical, organizational, operational) and how they are mitigated.
53
+
54
+ ## Expected Benefits
55
+ Summarize expected advantages and outcomes of the proposed design.
56
+
57
+ `;
58
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
59
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.PROPOSAL);
60
+ },
61
+
62
+ critiquePrompt: (proposalContent: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
63
+ const basePrompt = `Review this proposal from a systems generalist perspective.
64
+
65
+ Proposal:
66
+ ${proposalContent}
67
+
68
+ Structure your response as follows:
69
+ ## Strengths
70
+ Identify coherence, balanced trade-offs, and effective integration across domains.
71
+
72
+ ## Weaknesses
73
+ Highlight inconsistencies, missing dependencies, or unresolved trade-offs.
74
+
75
+ ## Suggested Improvements
76
+ Propose ways to better align performance, security, scalability, and maintainability goals.
77
+
78
+ ## Integration Risks
79
+ List potential conflicts or risks arising from domain misalignment (e.g., security vs. usability, performance vs. maintainability).
80
+ `;
81
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
82
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.CRITIQUE);
83
+ },
84
+
85
+ refinePrompt: (originalContent: string, critiquesText: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
86
+ const basePrompt = `Original proposal:
87
+ ${originalContent}
88
+
89
+ Critiques:
90
+ ${critiquesText}
91
+
92
+ Refine your proposal to achieve better cross-domain coherence and balance.
93
+
94
+ Use this structure:
95
+ ## Revised Integrated Design
96
+ Summarize how the updated solution improves system-wide balance and alignment.
97
+
98
+ ## Changes Made
99
+ List modifications and the rationale behind them.
100
+
101
+ ## Improved Trade-offs
102
+ Explain how the design better balances competing goals (e.g., security vs. performance).
103
+
104
+ ## Remaining Conflicts
105
+ Note any unresolved tensions or design questions that still need consideration.
106
+
107
+ `;
108
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
109
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.REFINEMENT);
110
+ },
111
+
112
+ summarizePrompt: (content: string, maxLength: number) => {
113
+ const basePrompt = `You are summarizing the debate history from a generalist systems perspective.
114
+
115
+ Debate history to summarize:
116
+ ${content}
117
+
118
+ Summarize the discussion focusing on cross-domain integration, design coherence, and trade-offs.
119
+
120
+ Format:
121
+ ## System Overview
122
+ Summarize the overall design direction and intent.
123
+
124
+ ## Key Agreements
125
+ List areas of consensus across domain specialists.
126
+
127
+ ## Trade-offs & Balances
128
+ Describe how major conflicts were resolved or balanced.
129
+
130
+ ## Open Issues
131
+ Identify unresolved design tensions or open questions for future consideration.
132
+
133
+ Limit the summary to a maximum of ${maxLength} characters.`;
134
+ return appendSharedInstructions(basePrompt, INSTRUCTION_TYPES.SUMMARIZATION);
135
+ },
136
+
137
+ clarifyPrompt: (problem: string, context?: DebateContext, agentId?: string, includeFullHistory?: boolean) => {
138
+ const basePrompt = `You are preparing clarifying questions from a systems generalist perspective.
139
+
140
+ Problem to clarify:
141
+ ${problem}
142
+
143
+ Ask zero or more concise, high-value questions that help integrate or clarify cross-domain concerns.
144
+
145
+ Focus on:
146
+ - High-level functional goals and scope
147
+ - Interactions between architectural, performance, and security aspects
148
+ - Ambiguous responsibilities or unclear data ownership
149
+ - Expected evolution and maintainability
150
+ - System boundaries and dependencies
151
+
152
+ `;
153
+ const promptWithContext = prependContext(basePrompt, context, agentId, includeFullHistory);
154
+ return appendSharedInstructions(promptWithContext, INSTRUCTION_TYPES.CLARIFICATION);
155
+ },
156
+ };
157
+
@@ -0,0 +1,41 @@
1
+ import { architectPrompts } from './architect-prompts';
2
+ import { performancePrompts } from './performance-prompts';
3
+ import { securityPrompts } from './security-prompts';
4
+ import { testingPrompts } from './testing-prompts';
5
+ import { generalistPrompts } from './generalist-prompts';
6
+ import { kissPrompts } from './kiss-prompts';
7
+ import { RolePrompts } from './prompt-types';
8
+ import { AGENT_ROLES, AgentRole } from '../../types/agent.types';
9
+
10
+ /**
11
+ * Internal registry mapping agent roles to their corresponding prompt configurations.
12
+ *
13
+ * This centralized registry allows for easy lookup of role-specific prompts
14
+ * without needing separate agent classes for each role.
15
+ *
16
+ */
17
+ const ROLE_PROMPTS_REGISTRY: Partial<Record<AgentRole, RolePrompts>> = {
18
+ [AGENT_ROLES.ARCHITECT]: architectPrompts,
19
+ [AGENT_ROLES.PERFORMANCE]: performancePrompts,
20
+ [AGENT_ROLES.SECURITY]: securityPrompts,
21
+ [AGENT_ROLES.TESTING]: testingPrompts,
22
+ [AGENT_ROLES.GENERALIST]: generalistPrompts,
23
+ [AGENT_ROLES.KISS]: kissPrompts,
24
+ };
25
+
26
+ /**
27
+ * Retrieves the prompt configuration for a given agent role.
28
+ *
29
+ * If the role is not found in the registry, defaults to architect prompts
30
+ * to maintain backward compatibility and ensure system stability.
31
+ *
32
+ * @param role - The agent role to get prompts for.
33
+ * @returns The RolePrompts configuration for the specified role.
34
+ */
35
+ export function getPromptsForRole(role: AgentRole): RolePrompts {
36
+ return ROLE_PROMPTS_REGISTRY[role] ?? architectPrompts;
37
+ }
38
+
39
+ // Re-export types for convenience
40
+ export type { RolePrompts } from './prompt-types';
41
+
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Default summary prompt for the judge when summarizing debate history for synthesis.
3
+ *
4
+ * The judge's perspective is different from agents - it focuses on extracting key decisions,
5
+ * trade-offs, and recommendations from the debate to inform the final synthesis.
6
+ */
7
+ export const DEFAULT_JUDGE_SUMMARY_PROMPT = (content: string, maxLength: number): string =>
8
+ `You are a technical judge preparing to synthesize a final solution from a debate. Summarize the following debate history, focusing on the most important decisions, trade-offs, and recommendations that will inform the final synthesis.
9
+
10
+ Debate history to summarize:
11
+ ${content}
12
+
13
+ Create a concise summary (maximum ${maxLength} characters) that captures:
14
+ - Key architectural decisions and their rationale
15
+ - Important trade-offs identified across different perspectives
16
+ - Critical recommendations and concerns raised
17
+ - Evolution of the solution through the debate rounds
18
+
19
+ Focus on information that will be essential for creating a well-informed final synthesis.`;