Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/assets/generic/sdd-orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ Anti-patterns — these ALWAYS inflate context without need:
- Running tests or builds inline → delegate
- Reading files as preparation for edits, then editing → delegate the whole thing together

### Empty Sub-Agent Response Recovery

When a sub-agent returns empty, minimal, or tool-result-only output (e.g., "Observation saved", a raw tool response, or blank):

1. Do NOT launch a new sub-agent — this wastes the completed work and full context.
2. RESUME the same task using the existing `task_id`, adding a prompt: "Your work completed but I received no text response. Please provide your findings/summary as text now."
3. If the second attempt also returns empty, THEN report the issue to the user with the task ID and last output received.

**Why**: Sub-agents sometimes end with a tool call (e.g., `mem_save`) as their last action, causing the orchestrator to receive only the tool result instead of the analysis. Resuming preserves the sub-agent's full context; re-launching discards all work done.

## SDD Workflow (Spec-Driven Development)

SDD is the structured planning layer for substantial changes.
Expand Down
8 changes: 8 additions & 0 deletions internal/assets/skills/_shared/persistence-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ After completing your work, you MUST call:
If you return without calling mem_save, the next phase CANNOT find your artifact and the pipeline BREAKS.
```

## Sub-Agent Response Ordering

When a sub-agent persists artifacts (via `mem_save` or file writes), the persistence call MUST happen BEFORE the final text response. The sub-agent's absolute last output must be text, never a tool call.

**Why**: The parent agent only receives the sub-agent's final output. If the last action is a tool call (e.g., `mem_save`), the parent sees the tool result ("Observation saved") instead of the sub-agent's actual analysis and findings.

Order: do work → persist artifact (`mem_save`) → return text summary as final action.

## Skill Registry

The orchestrator pre-resolves compact rules from the skill registry and injects them as `## Project Standards (auto-resolved)` in your launch prompt. Sub-agents do NOT read the registry or individual SKILL.md files — rules arrive pre-digested.
Expand Down
2 changes: 2 additions & 0 deletions internal/assets/skills/_shared/sdd-phase-common.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Return result inline only. Do not write any files or call `mem_save`.

## D. Return Envelope

> **CRITICAL — Response ordering**: Your FINAL output MUST be text (the return envelope), NOT a tool call. If you need to save to Engram (`mem_save`), do it BEFORE your final text response. Do NOT call `mem_session_summary` — that's for top-level agents only. **Why**: When a sub-agent's last action is a tool call, the parent agent receives only the tool result — your text response (the actual analysis) is lost.

Every phase MUST return a structured envelope to the orchestrator:

- `status`: `success`, `partial`, or `blocked`
Expand Down