You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
meetings at 25%/50%/60% completion (task_completed)
98
-
g. TEST: TestRunner executes pytest/node, parses results + coverage
101
+
h. TEST: TestRunner executes pytest/node, parses results + coverage
99
102
Traceability tracker updates requirement-test status
100
-
h. HEALTH: HealthTracker computes score (0-100) and grade (A-F)
103
+
i. GATE: Test pass rate gate -- auto-fix if below threshold
104
+
(explorer: no gate, builder: 50%/1 fix, architect: 80%/2 fixes)
105
+
j. HEALTH: HealthTracker computes score (0-100) and grade (A-F)
101
106
HealthHistoryService persists trend data for Architect level
102
-
i. DEPLOY: Surface before_deploy rules as deploy_checklist event
107
+
k. DEPLOY: Surface before_deploy rules as deploy_checklist event
103
108
evaluateAndInvite('deploy_started') for device/web deploy meetings
104
109
If web: build -> find serve dir -> start local HTTP server -> open browser
105
110
If devices: resolveDeployOrder -> flash wizard per device
106
111
If CLI portals: execute via CliPortalAdapter (no shell)
107
-
j. COMPLETE: evaluateAndInvite('session_complete') -> Architecture agent meeting
112
+
l. COMPLETE: evaluateAndInvite('session_complete') -> Architecture agent meeting
108
113
5. session_complete event with summary
109
114
6. Post-build actions (optional):
110
115
- FIX: POST /api/sessions/:id/fix with bugReport -> Orchestrator.runFix()
@@ -158,7 +163,7 @@ In dev mode, Vite (port 5173) proxies `/api/*` and `/ws/*` to backend (port 8000
158
163
## Core Abstractions
159
164
160
165
### NuggetSpec
161
-
JSON schema produced by blockInterpreter from Blockly workspace. Drives the entire pipeline. Contains: goal, requirements (with test traceability), style, agents, deployment target, workflow flags (feedback loops, system level, behavioral tests), skills, rules, portals, devices, runtime config (agent name, voice, greeting), knowledge (backpack sources, study mode), composition (provides/requires interfaces for Spec Graph).
166
+
JSON schema produced by blockInterpreter from Blockly workspace. Drives the entire pipeline. Contains: goal, requirements (with test traceability), style, agents, deployment target, workflow flags (feedback loops, system level, behavioral tests), skills, rules, portals, devices, runtime config (agent name, voice, greeting), knowledge (backpack sources, study mode), composition (provides/requires interfaces for Spec Graph), framework (optional: phaser/p5/threejs/none -- auto-selected by MetaPlanner if not set).
162
167
163
168
### Task DAG
164
169
Directed acyclic graph of tasks with dependencies. Generated by MetaPlanner. Executed in topological order by Orchestrator. Uses Kahn's algorithm (`utils/dag.ts`).
Client sends `turn` (text) or `audio_turn` (audio) messages. Server responds with:
@@ -208,7 +211,7 @@ Client sends `turn` (text) or `audio_turn` (audio) messages. Server responds wit
208
211
209
212
-**Session state**: In-memory Maps with optional JSON persistence for checkpoint/recovery. Cleanup timer (5 min) starts on WS connect; cancelled at build start, re-armed in `.finally()` after build completes. Meeting activity (accept, message, end), kid-initiated meeting starts, and fix/launch requests also reset the timer. `impactEstimate` and `boundaryAnalysis` persisted on session during plan phase for Blueprint meeting context.
-**SDK query per task**: Each agent task calls `query()` from `@anthropic-ai/claude-agent-sdk` with `permissionMode: 'bypassPermissions'` and explicit `pathToClaudeCodeExecutable` (resolved once at module load by `agentRunner.ts`). The SDK uses system `node` to spawn `cli.js`. Node.js is a prerequisite; Electron main process shows a dialog prompting install if missing. Default `maxTurns=25` (`MAX_TURNS_DEFAULT`). On retry, grants 10 additional turns per attempt (`MAX_TURNS_RETRY_INCREMENT`), so retries progress: 25 → 35 → 45.
214
+
-**SDK query per task**: Each agent task calls `query()` from `@anthropic-ai/claude-agent-sdk` with `permissionMode: 'bypassPermissions'` and explicit `pathToClaudeCodeExecutable` (resolved once at module load by `agentRunner.ts`). The SDK uses system `node` to spawn `cli.js`. Node.js is a prerequisite; Electron main process shows a dialog prompting install if missing. Default `maxTurns=25` (`MAX_TURNS_DEFAULT`). On retry, grants 10 additional turns per attempt (`MAX_TURNS_RETRY_INCREMENT`), so retries progress: 25 → 35 → 45. Builder agents are instructed to self-verify by running `node tests/test_{task_id}.js` before writing their summary.
212
215
-**API key propagation**: `POST /api/internal/config` sets `process.env.ANTHROPIC_API_KEY` then calls `resetAnthropicClient()` to invalidate the singleton. Module-level services (`meetingAgentService`, `planningService`) call `getAnthropicClient()` per-use (no cached `this.client`) so key changes propagate immediately.
213
216
-**Stale metadata cleanup**: On each build, `setupWorkspace()` removes `.elisa/{comms,context,status}` from previous sessions before recreating them. Preserves `.elisa/logs/`, source files, and `.git/`.
214
217
-**Structural digest injection**: Agent task prompts include function/class signatures extracted from workspace source files (via `ContextManager.buildStructuralDigest()`), allowing agents to orient without reading each file.
@@ -218,6 +221,7 @@ Client sends `turn` (text) or `audio_turn` (audio) messages. Server responds wit
218
221
-**Context chain**: After each task, summary + structural digest written to `.elisa/context/nugget_context.md`.
219
222
-**Cancellation**: `Orchestrator.cancel()` via AbortController; signal propagated to Agent SDK `query()` calls. Session state set to `done` on error.
220
223
-**Content safety**: All agent prompts enforce age-appropriate output (8-14). Placeholder values sanitized before interpolation (`sanitizePlaceholder()`).
224
+
-**Game frameworks**: Phaser 3, p5.js, Three.js bundled in `build/frameworks/` (downloaded by `scripts/bundle-frameworks.mjs`). MetaPlanner auto-selects or kid picks via Goal block dropdown. Selected library copied to workspace `lib/` after planning. Multi-file architecture enforced: scaffold creates all files as stubs, each feature task owns one module file, no concurrent edits to same file.
221
225
-**Flash mutex**: `HardwareService.flash()` serializes concurrent calls via Promise-chain mutex.
222
226
-**WebSocket heartbeat + send queue**: Server sends protocol-level pings every 30s (`WS_PING_INTERVAL_MS`). Connections that miss a pong are terminated via `ws.terminate()`. All `sendEvent()` calls are serialized through a per-session FIFO queue with `setImmediate` yield between each frame, preventing burst-flooding the Vite proxy even when concurrent fire-and-forget callers (agent_output streaming, meeting triggers) overlap. Queue depth warnings at 10/50/100; drain summaries logged for batches >5. `wsAlive` WeakMap tracks per-connection liveness.
223
227
-**Graceful shutdown**: SIGTERM/SIGINT handlers cancel orchestrators, close WS server, 10s force-exit. `SessionStore.onCleanup` invokes `ConnectionManager.cleanup()` for WS teardown.
Copy file name to clipboardExpand all lines: backend/src/prompts/builderAgent.ts
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ relative to cwd automatically. Do not reference paths outside this workspace.
36
36
1. Scan the file manifest and structural digest below to understand what exists. Only Read specific files when you need implementation details not visible in signatures.
37
37
2. Plan your changes: identify which files to create or modify and how they fit together.
38
38
3. Implement the task, writing or editing files one at a time.
39
-
4. Verify your work: re-read changed files to confirm correctness, then write your summary.
39
+
4. Run your tests: execute \`node tests/test_{task_id}.js\` and check the output.
40
+
5. Fix any FAIL lines -- update your code or fix the test assertions. Re-run until all PASS.
41
+
6. Write your summary to .elisa/comms/{task_id}_summary.md.
40
42
41
43
## Turn Efficiency
42
44
You have a limited turn budget of {max_turns} turns. Prioritize implementation over exploration:
@@ -53,6 +55,10 @@ Rules:
53
55
- Output format: console.log('PASS: test_name') or console.log('FAIL: test_name')
54
56
- Do not delete test files or remove test entries
55
57
- Write assertions that genuinely verify the acceptance criteria
58
+
- After implementing, you MUST run \`node tests/test_{task_id}.js\` before writing your summary
59
+
- If a test requires browser APIs (DOM, canvas), convert it to a Node.js-compatible check \
60
+
(file existence, string matching, syntax validation) -- do NOT leave FAIL stubs
61
+
- If node is unavailable, state this clearly in your summary -- do not claim manual verification
56
62
57
63
## Rules
58
64
- Write clean, well-structured code appropriate for the nugget type.
@@ -108,6 +114,10 @@ export function formatTaskPrompt(params: {
108
114
}
109
115
}
110
116
117
+
if(task.id){
118
+
parts.push(`\n## Your Test File\nRun before finishing: node tests/test_${task.id}.js`);
0 commit comments