feat(kernel): brief echo-back gate (plan-pipeline-addenda A1)
New brief_echo stage before the planner in role_pipeline: the model restates the analyst brief as a structured artifact, and a deterministic gate (checkBriefEcho, opt-in via brief_echo=true) diffs the restatement against the original brief. On divergence — dropped requirements (Jaccard coverage < 0.34) or hallucinated files — it emits BriefEchoMismatchEvent and fails the stage retryably, so a misread brief never reaches plan generation. The diff (BriefEchoDiff) is a pure function of two recorded artifacts, so it is replay-safe and records no observation; the event fires only on mismatch, for audit. Symbols are recorded but non-blocking in v1. Mirrors the groundBrief- References gate. role_pipeline only; freestyle_planning wiring is a follow-up. Runtime install (like research): copy brief_echo.json + brief_echo.md and the [[artifacts]] block into ~/.config/correx.
This commit is contained in:
@@ -29,6 +29,11 @@ id = "review_report"
|
||||
schema_path = "schemas/review_report.json"
|
||||
llm_emitted = true
|
||||
|
||||
[[artifacts]]
|
||||
id = "brief_echo"
|
||||
schema_path = "schemas/brief_echo.json"
|
||||
llm_emitted = true
|
||||
|
||||
[[artifacts]]
|
||||
id = "execution_plan"
|
||||
schema_path = "schemas/execution_plan.json"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
You are about to plan. Before you do, RESTATE the analyst brief faithfully as JSON.
|
||||
|
||||
Rules:
|
||||
- Copy requirements exactly — do not merge, drop, or reword them.
|
||||
- Only reference files that are explicitly named in the brief.
|
||||
- Do not invent new scope, new files, or new symbols.
|
||||
|
||||
Emit your result as the `brief_echo` artifact (JSON, schema provided):
|
||||
- `goal`: the brief's goal in your own words (one sentence).
|
||||
- `referenced_files`: workspace-relative file paths named in the brief, verbatim.
|
||||
- `referenced_symbols`: class, interface, or function names named in the brief, verbatim.
|
||||
- `acceptance_criteria`: every requirement / acceptance criterion from the brief, one per item, verbatim.
|
||||
|
||||
If a field has no relevant content, emit an empty array. Do not add items that are not in the brief.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Role pipeline: analyst → architect → planner → implementer ⇄ reviewer
|
||||
# Role pipeline: analyst → architect → brief_echo → planner → implementer ⇄ reviewer
|
||||
#
|
||||
# Each stage produces a typed artifact that the next stage `needs`, so work flows forward
|
||||
# without a human relaying notes. The decision journal (pinned into every stage's context)
|
||||
@@ -18,6 +18,8 @@
|
||||
# id = "impl_plan"; schema_path = "schemas/impl_plan.json"; llm_emitted = true
|
||||
# [[artifacts]]
|
||||
# id = "review_report"; schema_path = "schemas/review_report.json"; llm_emitted = true
|
||||
# [[artifacts]]
|
||||
# id = "brief_echo"; schema_path = "schemas/brief_echo.json"; llm_emitted = true
|
||||
#
|
||||
# Prompt files (prompts/*.md, relative to this workflow) must exist for a real run.
|
||||
|
||||
@@ -45,7 +47,20 @@ produces = [{ name = "design", kind = "design" }]
|
||||
token_budget = 16384
|
||||
max_retries = 2
|
||||
|
||||
# 3. Break the design into ordered, verifiable steps.
|
||||
# 3a. Before planning: echo the analyst brief back as a structured artifact.
|
||||
# The brief_echo gate diffs the restatement against the original analysis;
|
||||
# on divergence (dropped requirements or hallucinated files) it fails the
|
||||
# stage (retryable) so the pipeline cannot reach plan generation on a misread brief.
|
||||
[[stages]]
|
||||
id = "brief_echo"
|
||||
prompt = "prompts/brief_echo.md"
|
||||
needs = ["analysis"]
|
||||
produces = [{ name = "brief_echo", kind = "brief_echo" }]
|
||||
brief_echo = true
|
||||
token_budget = 8192
|
||||
max_retries = 2
|
||||
|
||||
# 3b. Break the design into ordered, verifiable steps.
|
||||
[[stages]]
|
||||
id = "planner"
|
||||
prompt = "prompts/planner.md"
|
||||
@@ -90,12 +105,19 @@ condition_type = "artifact_validated"
|
||||
condition_artifact_id = "analysis"
|
||||
|
||||
[[transitions]]
|
||||
id = "architect-to-planner"
|
||||
id = "architect-to-brief-echo"
|
||||
from = "architect"
|
||||
to = "planner"
|
||||
to = "brief_echo"
|
||||
condition_type = "artifact_validated"
|
||||
condition_artifact_id = "design"
|
||||
|
||||
[[transitions]]
|
||||
id = "brief-echo-to-planner"
|
||||
from = "brief_echo"
|
||||
to = "planner"
|
||||
condition_type = "artifact_validated"
|
||||
condition_artifact_id = "brief_echo"
|
||||
|
||||
[[transitions]]
|
||||
id = "planner-to-implementer"
|
||||
from = "planner"
|
||||
|
||||
Reference in New Issue
Block a user