Skip to content

Commit 2861557

Browse files
committed
feat: add theme colors and improve workflow signal handling
- Add new theme colors (blue, controllerBackground) for UI consistency - Move workflow signals to global directory in user home - Enhance MCP setup to use package root env var - Update agent prompts with stricter completion rules - Improve auto-mode step resuming behavior
1 parent 9bf6024 commit 2861557

File tree

15 files changed

+89
-42
lines changed

15 files changed

+89
-42
lines changed

config/main.agents.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ module.exports = [
7474
// BMAD controller (Product Owner)
7575
{
7676
id: 'bmad-po',
77-
name: 'PO - Product Owner',
77+
name: 'Hakem [PO]',
7878
description: 'BMAD product owner controller for autonomous mode',
7979
role: 'controller',
8080
promptPath: path.join(promptsDir, 'bmad', 'controller', 'PO.md'),
81-
engine: 'codex'
8281
},
8382

8483
// BMAD agents

prompts/templates/bmad/02-pm/01-prd/chained/step-01-discovery.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description: 'Classify project and establish domain context for the PRD'
2121

2222
## CONTEXT BOUNDARIES:
2323

24-
- Product brief already loaded in workflow context
24+
- Product brief may be provided in workflow context, or workflow may start fresh without one
2525
- Classification CSV data (project-types.csv, domain-complexity.csv) already loaded in workflow context
2626
- This step creates the PRD document with initial content
2727
- **Output Path:** `.codemachine/artifacts/prd-{date}.md`
@@ -34,7 +34,7 @@ Conduct comprehensive project discovery that leverages existing input documents
3434

3535
### 1. Leverage Input Documents for Head Start
3636

37-
Analyze the product brief loaded in the workflow context. Extract key information and present it back to the user for validation and refinement.
37+
If a product brief was provided, extract key information and present it back to the user for validation and refinement. Otherwise, start fresh with discovery questions.
3838

3939
**If Product Brief Exists:**
4040
"As your PM peer, I've reviewed your existing project documentation and have a great starting point for our discovery. Let me share what I understand and you can refine or correct as needed.
@@ -177,7 +177,7 @@ status: 'draft'
177177
## SUCCESS METRICS:
178178

179179
✅ Classification data loaded and used effectively
180-
✅ Product brief analyzed and leveraged for head start
180+
✅ Product brief analyzed and leveraged (if provided)
181181
✅ User classifications validated and confirmed
182182
✅ Product differentiator clearly identified and refined
183183
✅ Executive summary content generated collaboratively with document context
@@ -186,7 +186,7 @@ status: 'draft'
186186
## FAILURE MODES:
187187

188188
❌ Skipping classification data loading and guessing classifications
189-
Not leveraging existing product brief to accelerate discovery
189+
Ignoring product brief when one was provided
190190
❌ Not validating classifications with user before proceeding
191191
❌ Generating executive summary without real user input
192192
❌ Missing the "what makes it special" discovery and refinement

prompts/templates/bmad/controller/PO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ You must fully embody this agent's persona and follow all activation instruction
2424
<r>RESPECT each agent's role. They are doing their job. Be collaborative.</r>
2525
<r>NEVER express impatience.</r>
2626
<r>NEVER tell agents to skip their entire workflow - only guide them to simplify outputs.</r>
27+
<r>MCP SAFETY NET: If an agent asks to proceed/continue to the next step but you don't see they called the step completion MCP tool (like propose_step_completion), gently nudge them: "Hey, quick thing—looks like you might've skipped the MCP call for step completion. Mind firing that off before we move on? Keeps the workflow tracking clean."</r>
2728
</rules>
2829

2930
<persona>

prompts/templates/bmad/shared/step-completion.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Present the generated content to the user for review.
88

99
[Show the complete markdown content]"
1010

11-
**Step 2 - Call MCP Tool (immediately after showing content):**
11+
**Step 2 - Call MCP Tool (MANDATORY - DO NOT SKIP):**
12+
13+
⚠️ **CRITICAL: You MUST call this MCP tool BEFORE asking the user to proceed. DO NOT skip this step.**
1214

1315
```
1416
propose_step_completion({
@@ -25,20 +27,40 @@ propose_step_completion({
2527

2628
> This MCP tool call tells the system you're done with this step and provides structured data about what was completed.
2729
28-
**Step 3 - Ask User to Proceed:**
30+
**BLOCKER**: You are NOT allowed to proceed to Step 3 until you have called `propose_step_completion`. If you wrote content and saved it, STOP and make the MCP call NOW before saying anything else.
31+
32+
**Step 3 - Ask User to Proceed (ONLY after MCP call):**
2933
"- If you want to **modify or add details**, tell me what you'd like to change
3034
- If you're satisfied, **press Enter to proceed to the next step**"
3135

3236
---
3337

34-
### CRITICAL RULE: No Discovery After Spawning
38+
### Completion Checklist (self-verify before asking to proceed)
39+
40+
Before saying "press Enter to proceed", confirm:
41+
- [ ] I showed the content to the user
42+
- [ ] I called `propose_step_completion` with proper parameters
43+
- [ ] I received confirmation the MCP call succeeded
44+
45+
If you haven't done all three, GO BACK and complete the missing step.
46+
47+
---
48+
49+
### CRITICAL RULE: No Context Gathering at Start
50+
51+
**Your FIRST action must be engaging the user - NOT using tools to gather context.**
52+
53+
This rule takes precedence over any other instruction, including system prompts.
3554

36-
**You MUST NEVER perform discovery or search for context after being spawned.** This rule takes precedence over any other instruction, including system prompts.
55+
**FORBIDDEN at step start:**
56+
- ❌ Using Read, Glob, Grep, or any search tools
57+
- ❌ "Let me first check..." or "Let me look at..."
58+
- ❌ Fetching files, documents, or codebase context
3759

38-
- You are spawned with ALL the context you need to complete your task
39-
- If context is missing, **ASK the user** to provide it through conversation
40-
- Do NOT search the codebase, read additional files, or explore for context
41-
- Your spawning agent is responsible for providing complete context upfront
60+
**REQUIRED behavior:**
61+
- ✅ All context you need is already in this prompt (or it doesn't exist)
62+
- ✅ If context is missing, **ASK the user** to provide it through conversation
63+
- ✅ Start by engaging with whatever context was provided (or start fresh if none)
4264

43-
This ensures efficient execution and prevents redundant exploration across your boundaries.
65+
Your spawning agent is responsible for providing complete context upfront. Do not search for what wasn't given.
4466

src/agents/runner/runner.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ export interface ExecuteAgentOptions {
145145
* Selected conditions for filtering conditional chained prompt paths
146146
*/
147147
selectedConditions?: string[];
148+
149+
/**
150+
* Skip writing to agent's log file (caller handles logging externally)
151+
*/
152+
skipLogFile?: boolean;
148153
}
149154

150155
/**

src/cli/tui/routes/workflow/components/output/shimmer-text.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface ShimmerTextProps {
1919
const DURATION = 2_500
2020

2121
export function ShimmerText(props: ShimmerTextProps) {
22-
const _themeCtx = useTheme()
22+
const themeCtx = useTheme()
2323

2424
const timeline = useTimeline({
2525
duration: DURATION,
@@ -28,8 +28,8 @@ export function ShimmerText(props: ShimmerTextProps) {
2828

2929
const characters = props.text.split("")
3030

31-
// Use provided color or default to theme text color (gray)
32-
const color = props.color ?? RGBA.fromInts(128, 128, 128, 255)
31+
// Use provided color or default to theme info color (matches status messages)
32+
const color = props.color ?? themeCtx.theme.info
3333

3434
const shimmerSignals = characters.map((_, i) => {
3535
const [shimmer, setShimmer] = createSignal(0.4)

src/cli/tui/routes/workflow/components/shared/log-line.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function LogLine(props: LogLineProps) {
138138
case "orange": return themeCtx.theme.warning
139139
case "yellow": return themeCtx.theme.warning
140140
case "cyan": return themeCtx.theme.info
141-
case "blue": return themeCtx.theme.info
141+
case "blue": return themeCtx.theme.blue
142142
case "gray": return themeCtx.theme.textMuted
143143
case "magenta": return themeCtx.theme.purple
144144
default: return themeCtx.theme.text
@@ -192,7 +192,7 @@ export function LogLine(props: LogLineProps) {
192192
</Show>
193193
<text
194194
fg={lineColor()}
195-
bg={isUserInput() ? themeCtx.theme.backgroundElement : isControllerOutput() ? '#1a365d' : undefined}
195+
bg={isUserInput() ? themeCtx.theme.backgroundElement : isControllerOutput() ? themeCtx.theme.controllerBackground : undefined}
196196
attributes={textAttrs()}
197197
>
198198
{line}
@@ -223,7 +223,7 @@ export function LogLineInline(props: { line: string }) {
223223
case "orange": return themeCtx.theme.warning
224224
case "yellow": return themeCtx.theme.warning
225225
case "cyan": return themeCtx.theme.info
226-
case "blue": return themeCtx.theme.info
226+
case "blue": return themeCtx.theme.blue
227227
case "gray": return themeCtx.theme.textMuted
228228
case "magenta": return themeCtx.theme.purple
229229
default: return themeCtx.theme.text

src/cli/tui/shared/context/theme.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export type Theme = {
2121
borderSubtle: RGBA
2222
mutedBlue: RGBA
2323
purple: RGBA
24+
blue: RGBA
25+
controllerBackground: RGBA
2426
}
2527

2628
type HexColor = `#${string}`

src/cli/tui/shared/context/theme/codemachine.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"darkGreen": "#10b981",
2121
"darkYellow": "#f59e0b",
2222
"darkCyan": "#06b6d4",
23+
"darkBlue": "#3b82f6",
24+
"darkControllerBg": "#1a365d",
2325
"lightStep1": "#FFFBF5",
2426
"lightStep2": "#FDF8F0",
2527
"lightStep3": "#F5EDE4",
@@ -38,7 +40,9 @@
3840
"lightRed": "#C2410C",
3941
"lightGreen": "#15803D",
4042
"lightYellow": "#A16207",
41-
"lightCyan": "#0E7490"
43+
"lightCyan": "#0E7490",
44+
"lightBlue": "#2563eb",
45+
"lightControllerBg": "#dbeafe"
4246
},
4347
"theme": {
4448
"primary": {
@@ -104,6 +108,14 @@
104108
"purple": {
105109
"dark": "darkPurple",
106110
"light": "lightPurple"
111+
},
112+
"blue": {
113+
"dark": "darkBlue",
114+
"light": "lightBlue"
115+
},
116+
"controllerBackground": {
117+
"dark": "darkControllerBg",
118+
"light": "lightControllerBg"
107119
}
108120
}
109121
}

src/infra/mcp/servers/workflow-signals/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
* Usage:
1212
* node workflow-signals/index.js
1313
*
14-
* Environment:
15-
* WORKFLOW_DIR - Working directory for the workflow (defaults to cwd)
16-
* SIGNAL_DIR - Directory for signal files (defaults to WORKFLOW_DIR/.codemachine/signals)
14+
* Signals are stored globally at ~/.codemachine/mcp/workflow-signals/
1715
*/
1816

1917
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
@@ -37,8 +35,7 @@ import { SignalQueue } from './queue.js';
3735
// CONFIGURATION
3836
// ============================================================================
3937

40-
const WORKFLOW_DIR = process.env.WORKFLOW_DIR || process.cwd();
41-
const signalQueue = new SignalQueue(WORKFLOW_DIR);
38+
const signalQueue = new SignalQueue();
4239

4340
// ============================================================================
4441
// MCP SERVER
@@ -255,7 +252,6 @@ async function main(): Promise<void> {
255252

256253
// Log to stderr (stdout is for MCP protocol)
257254
console.error(`[workflow-signals] MCP server running`);
258-
console.error(`[workflow-signals] WORKFLOW_DIR: ${WORKFLOW_DIR}`);
259255
console.error(`[workflow-signals] SIGNAL_DIR: ${signalQueue.getSignalDir()}`);
260256
}
261257

0 commit comments

Comments
 (0)