From 5206d4e5c0b9ae9ed11bef2d6e2ff9ef5c17c08f Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Sat, 11 Apr 2026 14:11:12 -0400 Subject: [PATCH] DOCS: PSF alignment for Task Orchestrator (RCA, Literate Docs, Flight Plan conversion) --- .../plans/flight-plan-task-orchestrator.org | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 system/plans/flight-plan-task-orchestrator.org diff --git a/system/plans/flight-plan-task-orchestrator.org b/system/plans/flight-plan-task-orchestrator.org new file mode 100644 index 0000000..6bd8857 --- /dev/null +++ b/system/plans/flight-plan-task-orchestrator.org @@ -0,0 +1,36 @@ +#+TITLE: Flight Plan: Consolidation VI - Task Orchestrator +#+DATE: 2026-04-11 +#+FILETAGS: :plan:architecture:psf:orchestrator: + +* Background & Motivation +The `cognitive-loop` pipeline (Consolidation V) established the functional gates (`perceive`, `neuro`, `consensus`, `decide`, `dispatch`). However, the `consensus-gate` remains a pass-through. Furthermore, the `org-agent` currently lacks the ability to formally verify GTD state transitions (Task Integrity) and hand off complex logic to background threads (Delegation). The Task Orchestrator integrates these three capabilities. + +* Scope & Impact +- *Target Files:* `projects/org-agent/src/core.lisp`, `projects/org-agent/src/neuro.lisp`, `projects/org-agent/src/symbolic.lisp`. +- *Impact:* The System 1 layer will spawn multiple threads to query providers simultaneously. System 2 will enforce GTD state integrity and manage sub-agent delegation. +- *Dependencies:* Requires `bordeaux-threads` for sub-agent management and the existing `org-gtd` v4.0 DAG. + +* Proposed Solution +1. **Parallel System 1 (`neuro.lisp`):** Modify `ask-neuro` to dispatch asynchronous requests to the `*provider-cascade*` using `bt:make-thread`. +2. **Deliberate Consensus (`core.lisp`):** Implement `consensus-gate` to wait for all parallel System 1 proposals. If they match, select the candidate. If they differ, query a fast, deterministic model (e.g., `groq`) to judge and select the safest Lisp `(:REQUEST ...)` form. +3. **Task Integrity (`symbolic.lisp`):** Add `task-integrity-check` inside `decide-gate`. If a task transition (e.g., `TODO` -> `DONE`) violates semantic rules (e.g., active children exist), reject the action and return an error stimulus to System 1. +4. **Delegation Hooks:** Define the `delegate-task` action type within the `dispatch-gate`, allowing the core to spawn isolated Lisp environments for long-running sub-agents. + +* Alternatives Considered +- *Fast Parallel Race:* First LLM to return a valid Lisp request wins. Rejected because it prioritizes speed over accuracy, violating the PSF safety mandates. + +* Implementation Plan +** Phase C: Success (Testing) +- Draft `projects/org-agent/tests/orchestrator-test.lisp`. +- Assert that `consensus-gate` correctly handles 3 diverging proposals and selects the safest one. +- Assert that `task-integrity-check` rejects closing a parent task with active children. + +** Phase D: Build (Engineering) +- Update `neuro.lisp` with `bt:make-thread` logic for `ask-neuro`. +- Implement `consensus-gate` in `core.lisp`. +- Implement `task-integrity-check` in `symbolic.lisp` and hook it into `decide-gate`. +- Implement `delegate-task` in `core.lisp` dispatch logic. + +* Verification & Rollback +- *Verification:* Hot-load the kernel and trigger a conflicting prompt. Verify the consensus judge resolves it. +- *Rollback:* The pipeline is functional. If the new `consensus-gate` fails, we can instantly revert it to the `(first proposals)` pass-through via Git and Swank hot-reloading.