feat: Add invariants system for Plan Mode verification

Adds rulespec.yaml and envelope.yaml support for machine-readable
invariant checking during plan completion.

- Add invariants module with Rulespec, ActionEnvelope, and evaluation logic
- Add Invariants section to system prompt with workflow instructions
- Show rulespec/envelope file status in plan verification output
- Rulespec written during planning (captures constraints from task)
- Envelope written after implementation (documents what was built)
This commit is contained in:
Dhanji R. Prasanna
2026-02-04 20:47:51 +11:00
parent 95d9847354
commit 3046f0dd6e
6 changed files with 1397 additions and 6 deletions

View File

@@ -63,7 +63,7 @@ pub fn format_tool_result_summary(
tool_result: &str,
tool_success: bool,
) -> ToolOutputFormat {
let is_todo_tool = tool_name == "todo_read" || tool_name == "todo_write";
let is_self_handled = is_self_handled_tool(tool_name);
let is_compact_tool = matches!(
tool_name,
"read_file"
@@ -77,7 +77,7 @@ pub fn format_tool_result_summary(
| "plan_approve"
);
if is_todo_tool {
if is_self_handled {
ToolOutputFormat::SelfHandled
} else if is_compact_tool {
if !tool_success {