Skip to content

Commit 8732082

Browse files
SmithSmith
authored andcommitted
Add context packet support and enhance governance policies
- Introduced checks for boot-time path-resolution availability in drift detection tests. - Added task_cache configuration to runtime policies, enabling recommendation-only cache guards. - Updated session outcomes to include detailed review pipeline results and lessons learned. - Enhanced execution report schema with diagnosis evidence structure for fixable retries. - Expanded delegation protocol schema to include context_packet for executor agents. - Implemented new scenarios for validating context packet usage and pre-wave cache guard behavior. - Established skill proposal criteria and structured templates for skill promotion governance. - Created new schemas for skill proposals, ensuring thorough review and approval processes.
1 parent 9b9939a commit 8732082

31 files changed

Lines changed: 871 additions & 1 deletion

.github/copilot-instructions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ npm run test:behavior # prompt-behavior + orchestration-handoff regr
1111
```
1212
Scenarios are in `evals/scenarios/`. Validate against matching schemas in `schemas/`.
1313

14+
## Path Resolution
15+
Agent resource paths are workspace-relative by default. When a file listed in any agent's `## Resources` section is not found in the active workspace root:
16+
1. Retry the read using the absolute prefix `{{VSCODE_USER_PROMPTS_FOLDER}}/` (for example, `{{VSCODE_USER_PROMPTS_FOLDER}}/governance/model-routing.json`).
17+
2. If still not found, log the missing path in the gate event and continue with `confidence` reduced by 0.1 per missing critical file.
18+
3. Never fabricate file contents. Never silently proceed as if a missing governance file contained default values.
19+
4. Applies to `governance/`, `schemas/`, `plans/project-context.md`, `docs/agent-engineering/`, and `skills/` paths referenced in agent `## Resources` sections.
20+
21+
This boot-time rule intentionally duplicates `docs/agent-engineering/TOOL-ROUTING.md` Rule 8 so global user-level agents can recover before `TOOL-ROUTING.md` itself is loaded.
22+
1423
## Failure Classification
1524
When status is `FAILED`, `NEEDS_INPUT`, `NEEDS_REVISION`, or `REJECTED`, include `failure_classification`:
1625
- `transient` — Flaky test, network timeout, or temporary tool unavailability; retry with identical scope.

BrowserTester-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Run end-to-end browser tests, verify UI/UX behavior, and check accessibility com
1717
`docs/agent-engineering/TOOL-ROUTING.md` is the authoritative source for local-first and external-fetch routing.
1818
Keep the health-first gate, observation-first protocol, accessibility severity rules, browser cleanup mandate, and schema-specific output fields inline in this file.
1919

20+
### Context Packet
21+
22+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
23+
2024
### Scope IN
2125
- E2E browser test execution by running provided test scripts or harnesses via runCommands/runTasks.
2226
- UI/UX behavior verification against validation matrix.

CoreImplementer-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Execute scoped implementation tasks from the conductor using strict TDD and dete
1616

1717
Keep the backend-specific schema contract, verification evidence, and Definition of Done expectations inline in this file.
1818

19+
### Context Packet
20+
21+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
22+
1923
### Scope IN
2024
- Implement assigned task scope only.
2125
- Write tests first, then minimal code.

Orchestrator.agent.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ See [docs/agent-engineering/MEMORY-ARCHITECTURE.md](docs/agent-engineering/MEMOR
9090
Agent-specific fields:
9191
- At phase completion, load `skills/patterns/memory-promotion-candidates.md` to identify candidate facts.
9292
- Then run Checklist C in `skills/patterns/repo-memory-hygiene.md` before promoting any fact to repo memory.
93+
- When a reusable cross-plan pattern emerges with confidence ≥ 0.85 at a phase or completion boundary, produce a skill proposal artifact using `plans/templates/skill-proposal-template.md` and save it to `plans/artifacts/<task-slug>/skill-proposals/`. Do NOT write directly to `skills/patterns/`; proposals must wait for human review and explicit approval before promotion to the active skill library.
9394
- Update `NOTES.md` only at phase boundaries for active objective/current phase; prune stale notes using `skills/patterns/repo-memory-hygiene.md` before any `/memories/repo/` write or NOTES update.
9495

9596
### State Tracking
@@ -308,6 +309,9 @@ For detailed per-agent parameter shapes and required/optional fields, load `sche
308309

309310
### Wave-Aware Execution
310311
When the plan (from Planner) contains `wave` fields on phases:
312+
313+
**Pre-Wave Cache Guard (before each wave):** Before dispatching any wave, scan `plans/artifacts/` for recently completed phases or tasks with a scope description that overlaps the current wave's phase titles or file targets. If a match is found, surface a recommendation to the operator (e.g., "Similar work detected in `<task-slug>` — review prior artifacts before proceeding?"). The guard produces recommendations only; it cannot silently mark any phase complete, skip a user approval gate, or modify the wave execution plan. If the cache guard evidence is absent or unavailable, skip silently and proceed.
314+
311315
1. Group phases by wave number (ascending).
312316
2. Within a wave, execute independent phases in parallel (up to `max_parallel_agents` limit).
313317
3. Wait for ALL phases in a wave to complete before advancing to the next wave.
@@ -325,6 +329,16 @@ When a subagent returns a `failure_classification`, Orchestrator routes automati
325329

326330
If retry limit is exhausted, escalate to user with accumulated failure evidence. For all dispatch actions in this table (retry or replan), apply the Universal Model Resolution Rule to resolve the `model` parameter — including needs_replan Planner dispatch.
327331

332+
### Diagnosis Packet (MEDIUM/LARGE — Fixable Retries)
333+
334+
For `fixable` failures on MEDIUM/LARGE plans, before dispatching a retry the Orchestrator MUST collect a diagnosis packet from the failing subagent's report or by reading the referenced build/test evidence. The packet must contain:
335+
- `reproduction_steps`: minimal command or scenario that reproduces the failure.
336+
- `root_cause_hypothesis`: one-sentence explanation of the underlying cause (not the symptom).
337+
- `affected_component`: the smallest file, schema, or module that needs to change.
338+
- `stack_trace_excerpt` (optional): key lines from error output or logs that confirm the root cause.
339+
340+
Include the diagnosis packet in the retry dispatch payload. A fixable retry dispatched without this packet on a MEDIUM/LARGE plan is non-compliant. For TRIVIAL/SMALL plans, the fix hint alone is sufficient.
341+
328342
### Retry Reliability Policy
329343
Use `governance/runtime-policy.json` as the source of truth for retry budgets, same-classification escalation, and transient wave throttling. Inline invariants: never proceed after empty response, timeout, or HTTP 429; include `retry_attempt` on transient retries; when the same `failure_classification` repeats to the configured threshold, escalate; if a phase fails 3 times with the same classification, escalate to the user.
330344

Planner.agent.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ For all other scopes, record applicability, impact, evidence source, and disposi
6464
- Record design decisions in the plan artifact's "Design Decisions" section (see plan document template).
6565
8. Planning (phase decomposition with quality gates).
6666
9. Handoff (artifact-first plan file plus `plan_path` handoff for Orchestrator; PLAN_REVIEW ownership remains with Orchestrator).
67+
- For MEDIUM/LARGE plans where Researcher produced a non-trivial evidence packet, set `context_packet_path` in the plan to the research digest artifact path so downstream executors can consume it without re-investigation.
6768

6869
### Clarification Policy
6970
Reference: `docs/agent-engineering/CLARIFICATION-POLICY.md`. Step 2 above is the authoritative gate. All five mandatory classes and the `vscode/askQuestions` format are defined in the policy doc.

PlatformEngineer-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Execute scoped infrastructure, CI/CD, and container operations from the conducto
1616

1717
Keep the platform-specific approval gates, idempotency mandate, rollback protocol, and health or deployment evidence inline in this file.
1818

19+
### Context Packet
20+
21+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
22+
1923
### Scope IN
2024
- Infrastructure deployment and configuration.
2125
- CI/CD pipeline setup and execution.

Researcher-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ You are Researcher-subagent, a research and evidence extraction agent.
1313
### Mission
1414
Return factual, evidence-linked research findings for the parent conductor/planner.
1515

16+
### Context Packet
17+
18+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
19+
1620
### Scope IN
1721
- File discovery and focused reading.
1822
- Pattern extraction grounded in code evidence.

TechnicalWriter-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Generate accurate technical documentation, Mermaid diagrams, and maintain strict
1717
`docs/agent-engineering/TOOL-ROUTING.md` is the authoritative source for local-first and external-fetch routing.
1818
Keep documentation parity, Mermaid rules, documentation-only constraints, and schema-specific output fields inline in this file.
1919

20+
### Context Packet
21+
22+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
23+
2024
### Scope IN
2125
- Technical documentation creation (API docs, architecture docs, guides).
2226
- Mermaid diagram generation for architecture/flow visualization.

UIImplementer-subagent.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Implement scoped UI/frontend tasks with deterministic quality gates: tests, buil
1717

1818
Keep the frontend-specific accessibility gates, responsive checks, design-system boundaries, and output evidence inline in this file.
1919

20+
### Context Packet
21+
22+
If `context_packet` is present in your dispatch, read the referenced `artifact_path` first before opening raw source files. Skip re-investigation of paths listed in `do_not_re_read` unless contradicting evidence is found.
23+
2024
### Scope IN
2125
- UI components and layout changes.
2226
- Styling within project design system.

docs/agent-engineering/MEMORY-ARCHITECTURE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,18 @@ Automation and machine-enforced invariants that prevent the three canonical poll
137137
- `skills/patterns/repo-memory-hygiene.md` — write-side dedup checklist for `/memories/repo/` and NOTES.md prune routine.
138138
- `evals/archive-completed-plans.mjs` — task-episodic auto-archive script.
139139
- `evals/drift-checks.mjs` — exports `validateNotesMdStyle` consumed by Pass 7.
140+
141+
## Pre-Wave Cache Guard
142+
143+
Before dispatching each wave, Orchestrator scans `plans/artifacts/` (task-episodic memory) for recently completed phases or tasks whose scope overlaps the current wave. This is a read-only operation against the task-episodic layer.
144+
145+
**Evidence source:** task-episodic memory (`plans/artifacts/<task-slug>/`) — the authoritative record of completed work.
146+
147+
**Output:** a human-visible recommendation only. The guard cannot silently complete a phase, skip an approval gate, or modify the wave execution plan.
148+
149+
**Configuration:** `governance/runtime-policy.json → task_cache` controls whether the guard is enabled and how many prior phases to scan (`lookback_phases`).
150+
151+
**Memory layer relationship:**
152+
153+
- Reads from: task-episodic (`plans/artifacts/`).
154+
- Does not write to any memory layer. The recommendation is surfaced inline in the Orchestrator's progress summary.

0 commit comments

Comments
 (0)