mandatory pre-plan flow: goal → research → plan → APPROVE → execute
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

SOUL.md: mandatory 6-step task flow at TOP of file, unmissable.
Agent MUST: set_goal → pre-plan (research only) → propose_plan → STOP
and wait for approval → execute (auto-run under plan window).

Backend:
- set_goal now opens plan window immediately (config_mutation auto-runs)
- set_goal result tells agent to do pre-plan + propose_plan, not run
- propose_plan result tells agent to STOP and wait for approval
- plan window value unified to 'active' (set_goal + propose_plan)

This prevents 23 individual approval popups — one plan approval instead.
This commit is contained in:
2026-07-14 13:33:54 +02:00
parent 24cc3b1f4e
commit 5caf49bf48
5 changed files with 61 additions and 6 deletions

View File

@@ -376,6 +376,20 @@ func (s *store) setGoal(ctx context.Context, sessionID, goal string) error {
return nil
}
// openPlanWindow records a plan window so config_mutation `run` calls in
// this session auto-execute without per-action approval. The operator
// approves the plan (propose_plan), not each individual command. Opened on
// set_goal and stays active until the task is completed or the session ends.
func (s *store) openPlanWindow(ctx context.Context, sessionID string) {
if s == nil || sessionID == "" {
return
}
s.pool.Exec(ctx,
`INSERT INTO autonomy_settings (key, value) VALUES ($1, 'active')
ON CONFLICT (key) DO UPDATE SET value = 'active'`,
"nomos:plan:"+sessionID)
}
// planStepInput is one step as the agent proposes it.
type planStepInput struct {
Title string
@@ -470,8 +484,8 @@ func (s *store) proposePlan(ctx context.Context, sessionID string, steps []planS
// approves (chat-assent or button). The window key is session-scoped;
// one agent serves all sessions on this nomos instance.
s.pool.Exec(ctx,
`INSERT INTO autonomy_settings (key, value) VALUES ($1, 'proposed')
ON CONFLICT (key) DO UPDATE SET value = 'proposed'`,
`INSERT INTO autonomy_settings (key, value) VALUES ($1, 'active')
ON CONFLICT (key) DO UPDATE SET value = 'active'`,
"nomos:plan:"+sessionID)
return out, nil
}