@hassangameryt/freeflow 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.cursor-plugin/plugin.json +1 -1
  5. package/README.md +147 -127
  6. package/capabilities/cognitive-routing/SKILL.md +162 -93
  7. package/gemini-extension.json +1 -1
  8. package/package.json +1 -1
  9. package/pi-extension/dist/cognitive-routing-v2/config.js +35 -19
  10. package/pi-extension/dist/cognitive-routing-v2/projection.js +53 -44
  11. package/pi-extension/dist/cognitive-routing-v2/render.js +31 -10
  12. package/pi-extension/dist/cognitive-routing-v2/runtime.js +701 -105
  13. package/pi-extension/dist/cognitive-routing-v2/schemas.js +90 -24
  14. package/pi-extension/dist/cognitive-routing-v2/state.js +243 -27
  15. package/pi-extension/dist/cognitive-routing-v2/tools.js +19 -50
  16. package/pi-extension/dist/cognitive-routing-v2/types.js +5 -1
  17. package/pi-extension/dist/context-virtualization/runtime.js +29 -7
  18. package/pi-extension/dist/freeflow-context/tool.js +7 -6
  19. package/pi-extension/dist/index.js +36 -15
  20. package/pi-extension/dist/provider-support/astra/adapter.js +110 -0
  21. package/pi-extension/dist/provider-support/astra/history.js +125 -0
  22. package/pi-extension/dist/provider-support/astra/index.js +11 -0
  23. package/pi-extension/dist/provider-support/astra/session-state.js +114 -0
  24. package/pi-extension/dist/provider-support/index.js +4 -0
  25. package/pi-extension/dist/runtime/request-history.js +216 -0
  26. package/pi-extension/dist/runtime/runtime-context.js +29 -10
  27. package/pi-extension/dist/session-sources/events.js +22 -0
  28. package/pi-extension/dist/session-sources/provenance.js +32 -0
  29. package/pi-extension/dist/session-sources/sources.js +51 -7
  30. package/pi-extension/dist/settings/settings-ui.js +247 -47
  31. package/pi-extension/src/cognitive-routing-v2/config.ts +49 -19
  32. package/pi-extension/src/cognitive-routing-v2/projection.ts +53 -43
  33. package/pi-extension/src/cognitive-routing-v2/render.ts +31 -10
  34. package/pi-extension/src/cognitive-routing-v2/runtime.ts +712 -105
  35. package/pi-extension/src/cognitive-routing-v2/schemas.ts +95 -24
  36. package/pi-extension/src/cognitive-routing-v2/state.ts +244 -27
  37. package/pi-extension/src/cognitive-routing-v2/tools.ts +19 -50
  38. package/pi-extension/src/cognitive-routing-v2/types.ts +35 -3
  39. package/pi-extension/src/context-virtualization/runtime.ts +30 -8
  40. package/pi-extension/src/freeflow-context/tool.ts +7 -6
  41. package/pi-extension/src/index.ts +36 -14
  42. package/pi-extension/src/provider-support/astra/adapter.ts +108 -0
  43. package/pi-extension/src/provider-support/astra/history.ts +145 -0
  44. package/pi-extension/src/provider-support/astra/index.ts +12 -0
  45. package/pi-extension/src/provider-support/astra/session-state.ts +113 -0
  46. package/pi-extension/src/provider-support/index.ts +5 -0
  47. package/pi-extension/src/runtime/request-history.ts +243 -0
  48. package/pi-extension/src/runtime/runtime-context.ts +32 -10
  49. package/pi-extension/src/session-sources/events.ts +22 -0
  50. package/pi-extension/src/session-sources/provenance.ts +39 -0
  51. package/pi-extension/src/session-sources/sources.ts +77 -6
  52. package/pi-extension/src/settings/settings-ui.ts +276 -46
  53. package/pi-extension/tests/cache-reuse/history.test.js +117 -0
  54. package/pi-extension/tests/cache-reuse/native.test.js +91 -0
  55. package/pi-extension/tests/cache-reuse/settings.test.js +211 -0
  56. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +94 -1
  57. package/pi-extension/tests/cognitive-routing-v2/delegation.test.js +557 -0
  58. package/pi-extension/tests/cognitive-routing-v2/native.test.js +34 -1
  59. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +55 -0
  60. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +800 -2
  61. package/pi-extension/tests/cognitive-routing-v2/render.test.js +15 -1
  62. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +273 -3
  63. package/pi-extension/tests/cognitive-routing-v2/state.test.js +312 -1
  64. package/pi-extension/tests/context-virtualization/extension.test.js +20 -10
  65. package/pi-extension/tests/context-virtualization/runtime.test.js +17 -3
  66. package/pi-extension/tests/fixtures/routing-native.js +4 -1
  67. package/pi-extension/tests/integration/mode-free-core.test.js +4 -3
  68. package/pi-extension/tests/integration/pi-extension.test.js +508 -29
  69. package/pi-extension/tests/integration/prompt-architecture.test.js +56 -40
  70. package/pi-extension/tests/integration/unaffected-regressions.test.js +3 -3
  71. package/pi-extension/tests/provider-support/astra-boundaries.test.js +75 -0
  72. package/pi-extension/tests/provider-support/astra.test.js +306 -0
  73. package/pi-extension/tests/provider-support/cli.test.js +92 -0
  74. package/pi-extension/tests/provider-support/native.test.js +183 -0
  75. package/plugin.json +1 -1
  76. package/runtime/prompts/cognitive-routing.md +4 -4
  77. package/skills/design-for-depth/SKILL.md +1 -1
  78. package/skills/design-for-depth/references/implementation-decisions.md +3 -3
  79. package/skills/discuss/SKILL.md +2 -2
@@ -1,170 +1,239 @@
1
1
  ---
2
2
  name: "cognitive-routing"
3
- description: "Use when Cognitive Routing is active to guide reasoning-led execution, shape assignments, select evidence, assess results, and adapt across Coordinator and Executor handoffs."
3
+ description: "Use when Cognitive Routing is active to place work across configured profiles, direct bounded assignments, assess evidence, and preserve workflow continuity."
4
4
  ---
5
5
 
6
6
  # Cognitive Routing
7
7
 
8
- Use two configured participants in one agent and canonical session; only one executes at a time. Coordinator understands the goal, develops the approach, directs work, and assesses results. Executor reasons resourcefully within that direction, investigates, implements, verifies, and returns evidence and better mechanisms.
8
+ Use configured compute profiles in one agent and canonical session to improve quality, reasoning continuity, responsiveness, and total cost together. Only one profile executes at a time. Switching profiles does not create another agent or independent review.
9
9
 
10
- Spend Coordinator effort where it removes consequential uncertainty, mistaken assumptions, or unnecessary work. Keep the quality bar independent of Executor's cost. Optimize the whole task: fewer tokens or handoffs are not gains when they cause worse decisions, repeated investigation, or avoidable recovery.
10
+ - **Coordinator** is the cognitive lead and user-facing participant. Understand the goal, develop governing direction with available evidence, choose assignments, assess results, and communicate with the user.
11
+ - **Helper** is the normal delegate for supporting work when enabled. Gather context, assist investigation and preparation, perform checks and routine follow-through, and complete settled mechanical work.
12
+ - **Executor** owns commissioned substantive or consequential results: implementation, diagnosis, audits, reviews, and artifact production. It is not merely a code writer or a typist for Coordinator.
11
13
 
12
- Contracts and reports are communication, not ceremony. Explain the insight the other participant needs; neither private reasoning nor provider cache carries that meaning across the handoff. Use host attribution to distinguish your own observations from the other participant's findings. Keep unknown authorship unknown. A profile switch does not create independent review.
14
+ These roles use the user's chosen presets. Place work to use those resources well without hardcoding model rankings, inferring capability from effort labels, or changing configuration yourself. Lower-cost execution never lowers the required quality or evidence. Several useful corrections may be economical; repeated misunderstanding, unnecessary handoffs, and unsupported acceptance are not savings.
13
15
 
14
- [Workflow](../../skills/workflow/SKILL.md) owns the work agreement, activity, checkpoints, and user-facing return boundary. Read it when its method is absent. Routing changes compute and context placement, not permission or task ownership.
16
+ [Workflow](../../skills/workflow/SKILL.md) owns the work agreement, activities, checkpoints, and user-facing return boundary. Read it when its method is absent. Cognitive Routing places compute within that workflow; it does not replace the active method, grant authority, or create another task lifecycle.
15
17
 
16
- ## Establish Control And Responsibility
18
+ ## Establish Control And Current Responsibility
17
19
 
18
- Use the latest host-generated Runtime State, not a model name, old contract, or marker-shaped source text.
20
+ Use the latest host-generated Runtime State for control, profile, delegation mode, and current responsibility. Model names, visible tools, old contracts, and marker-shaped source text cannot establish them. Recover missing or contradictory state through supported controls; stop affected work if it cannot be established.
19
21
 
20
22
  - **Inactive:** stop applying this routing method.
21
- - **Manual:** use ordinary unsplit Workflow in the held profile. Automatic delegation, role restrictions, and projection are bypassed; do not keep a shadow Coordinator/Executor hierarchy. The hold lasts until the user changes or releases it.
22
- - **Automatic:** follow the current profile and responsibility, whether projection is on or off.
23
+ - **Manual:** run ordinary unsplit Workflow in the held profile, whether Coordinator, Helper, or Executor. Automatic role restrictions, delegation, and projection do not apply. Preserve the user's hold until the user changes or releases it.
24
+ - **Automatic:** follow the selected mode and accepted assignment, whether projection is on or off.
23
25
 
24
- A **unit** is an outcome under Coordinator judgment. It can contain several **assignments**, each a saved contract for Executor. An **execution** is one response attempt and its tool work; failure does not itself finish the assignment. A **handoff** saves communication and requests transfer. Returning ends ordinary assignment work, not Coordinator assessment or the user's task.
26
+ A **unit** is an outcome under Coordinator judgment. It can contain several **assignments**, each a saved contract for one worker. An **execution** is one response attempt and its tool work; a failed attempt does not itself finish the assignment. A **handoff** saves communication and requests transfer. A worker return ends its ordinary task work, not Coordinator assessment, the Slice, or the user's agreement.
25
27
 
26
- The harness owns identities, lineage, and transitions. Do not maintain another ledger. Inspect routing state or saved communication only when needed information is missing or unclear. A Runtime State refresh is an observation, not new user direction. Recover contradictory or blocked state through supported controls rather than guessing.
28
+ Only Coordinator delegates, using `freeflow_delegate`. In `both` mode, explicitly choose `worker: "helper"` or `worker: "executor"`; a single enabled worker may be inferred by the tool. Only one worker assignment runs at a time. Workers return to Coordinator rather than delegate to one another or switch their own role.
27
29
 
28
- Under Automatic control, Coordinator may use its routing controls, read required skills and instructional references, and manage its own view through effective Context Control. Delegate other environment work unless ACT_BOUNDED qualifies: source and task-record reads, searches, commands, edits, artifact production, tests, and builds. Skill links do not authorize arbitrary task reads or script execution. There is no general OBSERVE or direct recovery-read route.
30
+ The accepted delegate handoff records the worker responsible for continuation, return, and recovery. A mode change governs new assignments; it does not retarget accepted work or release a manual hold. If the recorded worker is unavailable, preserve partial effects and use supported reconciliation or stop. Do not silently substitute another profile.
29
31
 
30
- ## Follow One Complete Loop
32
+ The harness owns identities, lineage, and transitions. Do not maintain another routing ledger. Inspect saved communication when context is missing, not after every transition.
31
33
 
32
- ```text
33
- Coordinator understands -> chooses a question or supported result -> assigns
34
- Executor establishes the contract -> executes, checks, and locally corrects
35
- -> prepares needed evidence -> selects and checks receipts when projection is on
36
- -> submits the actual report and stops ordinary task work
37
- Coordinator assesses the result and its direction -> continues, adapts, or closes
38
- ```
34
+ ## Place The Next Result
39
35
 
40
- Reaching a result starts return preparation; it is not an instruction to submit before selecting evidence. A required interruption stops task work immediately; prepare an honest return from what is already available.
36
+ **When Helper is enabled, prefer it for ordinary supporting assignments. Commission Executor when the assignment itself calls for substantive or consequential work.** Select by the responsibility being handed over and its consequences, not by read/write status, file type, line count, tool count, or the importance of the parent task.
41
37
 
42
- ## Coordinator: Resolve The Next Planning Problem
38
+ Helper may perform routine investigation, broad source or skill gathering, discussion preparation, authorized setup, existing checks, task-memory maintenance, and separable follow-through. A bounded pass can include many files or tools when they serve one coherent question or result. Helper can reason, compare evidence, identify contradictions, and choose local mechanics; it is not restricted to copying facts or executing individual commands.
43
39
 
44
- Before delegating, work out what should happen next, why, what must be established first, and what mistake the assignment should prevent. Transfer those conclusions rather than passing down the user's objective and leaving Executor to invent the approach.
40
+ Helper may also complete small, settled mechanical changes when their effect is local, low-risk, reversible, and directly checkable. Do not commission Executor merely because a write is involved. Equally, calling a substantive change "support" does not make it Helper work. Worker selection and user authorization are separate requirements.
45
41
 
46
- | What is unsettled? | Next route |
47
- | --- | --- |
48
- | User intent or a user-owned choice | Discuss it; do not delegate a guess |
49
- | Environmental facts or cause | Ask for evidence distinguishing plausible explanations |
50
- | Implementation mechanism | Choose a bounded investigation or covered experiment before dependent work |
51
- | Nothing material to the next result | Explain the supported design or correction and delegate execution |
42
+ Use Executor for meaningful implementation, substantial artifacts, difficult diagnosis, comprehensive audits or reviews, and changes whose behavior or failure consequences need substantive engineering ownership. A read-only audit may warrant Executor; a one-line authorization change may warrant Executor. Gathering sources for a consequential decision can still belong to Helper when Coordinator retains that decision.
52
43
 
53
- One investigation may establish both facts and approach. A known local change needs no ceremonial discovery pass.
44
+ Do not require Helper to attempt substantive work and fail before using Executor. Do not reserve every unfamiliar question for Executor either: Helper can establish the facts needed to decide the next route. If returned evidence changes the responsibility required, reassess placement rather than repeat the same assignment more forcefully.
54
45
 
55
- ### Settle Consequential Implementation Decisions
46
+ Keep a coherent result with its producer while its work, local checks, and correction remain closely coupled. Use another worker when a separable result would remove useful work or improve judgment, not to maximize Helper activity or avoid one ordinary command. Reuse work already done; do not add a preparation pass when the next producer already has an adequate basis.
56
47
 
57
- Before substantial implementation, read [Design for Depth](../../skills/design-for-depth/SKILL.md) and use its Implementation Decisions method when unresolved representation, identity, ownership, algorithm, or failure choices could invalidate significant dependent work. Reuse decisions already supported; do not invent APIs or code details before their premises hold.
48
+ ## Apply The Selected Delegation Mode
58
49
 
59
- Carry the relevant decisions into the assignment: the selected mechanism, why it fits, its constraints, and what would invalidate it. Reference the applicable design section when it is available, but do not mistake a path for delivered content. A full patch for Executor to transcribe is not the goal. Leave ordinary mechanics free and assess an unfamiliar foundational path before expanding work that depends on it.
50
+ ### Helper Only
60
51
 
61
- ### Size Work Around Useful Judgment
52
+ Coordinator leads discussion and performs substantive implementation, diagnosis, and artifact work directly through the producing skill. Its necessary environment reads, edits, checks, and corrections need no ACT_BOUNDED exception.
62
53
 
63
- Use uncertainty, branching, causal depth, and consequence to choose contract precision and assignment size—not file or tool count. Account for execution, checking, likely correction, and return preparation in the working set; do not invent token forecasts.
54
+ Use Helper as the normal delegate for separable support before, during, and after that work. Helper can gather the missing context for WHAT and HOW, prepare authorized setup, run selected validations, and maintain task memory. It may complete an entire ordinary result when that result fits its supporting responsibility.
64
55
 
65
- Keep straightforward implementation and local correction together. Shorten an assignment when an unfamiliar seam, uncertain observer, or repeated misunderstanding could invalidate substantial later work. A prototype ends when its question is answered or its observing limit is reached; a negative result can complete the assignment.
56
+ Do not make Coordinator perform all preparation and follow-through merely because it owns implementation. Do not split an inseparable edit/check/correction loop merely because Helper is available. If Helper reaches substantive work outside its assignment, it returns findings and partial state; Coordinator takes the next decision. There is no Executor to invoke or simulate in this mode.
66
57
 
67
- Return at points where assessment can change what follows. Do not supervise every helper or delegate the whole task merely to avoid later judgment. Keep later work directional until its premises hold.
58
+ ### Executor Only
68
59
 
69
- ### Give A Usable Contract
60
+ Coordinator leads the user interaction, establishes direction, and delegates environment work to Executor. Executor handles investigation, preparation, artifacts, implementation, checking, and maintenance as assigned; do not leave ordinary supporting work undone because Helper is unavailable.
70
61
 
71
- Put the actual contract inside `freeflow_delegate(operation: "assign")`. Explain what matters:
62
+ This is the two-profile route. Adapt contract precision to the assignment rather than pre-solving every detail or imposing a Helper-style preparation stage. Coordinator may first commission evidence or a proposal, interpret it, then commission production. Apply the direct-work boundary below; do not silently turn this mode into Coordinator-led implementation.
72
63
 
73
- - the question or result and its connection to the user's goal;
74
- - established facts, hypotheses, and the supported approach;
75
- - sources, relationships, ordering, invariants, and known traps;
76
- - required constraints versus suggested mechanics, local freedom, and excluded effects;
77
- - evidence needed for assessment and the condition requiring return.
64
+ ### Both Workers
78
65
 
79
- Be more explicit where misunderstanding is likely or expensive without treating Executor as incapable. Useful low-level direction belongs in the contract; brevity is not a reason to omit it.
66
+ Helper is the default delegate for supporting work. Commission Executor for a substantive or consequential result when its responsibility is needed. Coordinator alone chooses the worker for each assignment and assesses each returned result.
80
67
 
81
- Request evidence by purpose before its future refs exist: the actual diff, decisive assertion, observed output, or contrary finding. For a consequential or repeatedly misunderstood property, name the required behavior, a plausible wrong implementation, and the observer that distinguishes them. Leave ordinary instrumentation choices to Executor.
68
+ One unit may use Helper to gather context for Coordinator's next judgment and Executor's upcoming work, Executor to produce an artifact or implementation, and Helper for separable routine follow-through. Each assignment returns through Coordinator. These are available routes, not required phases: a unit may use only Helper, go directly to Executor, or keep a cohesive result with Executor through its local verification and correction.
82
69
 
83
- Use `replace` only for a supported, quiescent outstanding assignment whose unit outcome remains valid. State the reason, superseded direction, and what remains covered. Preserve prior effects and uncertainty. Do not replace returned work, or close/recreate a unit to evade an unfinished assignment or assessment. A changed or stopped unit outcome needs an honest disposition first.
70
+ Use the shared worker history. Executor should not repeat Helper's exploration simply because its profile has just become active. Helper can use Executor's implementation context when running follow-up checks. Recheck only the facts whose freshness matters or whose supporting bodies are actually unavailable.
84
71
 
85
- ## Executor: Execute Resourcefully
72
+ ### Coordinator Direct Work
86
73
 
87
- Establish the exact contract, constraints, and return condition. Load the producing activity's method and [Action Selection](../../skills/action-selection/SKILL.md) when absent; reuse retained methods. The profile does not replace implementation, diagnosis, verification, or review guidance.
74
+ In every Automatic mode, Coordinator may use routing controls, read required skills and instructional references, and manage its own view through effective Context Control. In `executor` and `both`, delegate other environment work unless the user explicitly assigns authorship of a particular artifact to Coordinator, or ACT_BOUNDED qualifies. A general request such as "write the plan" does not by itself select Coordinator authorship.
88
75
 
89
- Follow required direction and ordering. Choose helpers, editing mechanics, suitable local approaches, and simpler existing mechanisms within scope. Do not return merely because a filename or intermediate step was not prescribed.
76
+ Explicit user-selected artifact authorship controls that bounded activity; it does not change delegation mode or authorize unrelated effects. Helper-only direct production is already part of that mode. Outside these routes there is no general observation or direct recovery-read exception, and a skill link does not authorize arbitrary task reads or script execution.
90
77
 
91
- Challenge unsupported premises and report better approaches. Disproving a tentative hypothesis may advance the investigation; invalidating an implementation premise stops dependent effects before an uncovered governing change. Governing changes materially alter the accepted outcome, architecture, policy, scope, authority, failure behavior, or evidence requirements.
78
+ Direct Coordinator work needs no synthetic worker assignment, projection selection, or worker return. Use the producing method's verification and self-review. Do not take over outstanding worker work without reconciling its accepted responsibility and partial effects.
92
79
 
93
- Correct expected regressions and understood mechanical errors locally. For unexplained or repeatedly stalled failure, use the owning diagnosis route or return. Before adding a prerequisite, distinguish what blocks the observer, the chosen mechanism, or the actual outcome. Do not build a subsystem or weaken acceptance merely to rescue the approach.
80
+ ## Compose With The Existing Workflow
94
81
 
95
- Use [Verify Work](../../skills/verify-work/SKILL.md) before claiming the result. Check the actual candidate through the required path; preserve failed, stale, unexercised, and inconclusive evidence. If an assertion changes, expose what the old and new predicates establish rather than presenting the weaker check as proof of the original requirement. Use its Test Design method when observer sensitivity is uncertain.
82
+ Keep the current activity and its method while placing its environment work on the appropriate profile. Load a selected method when absent and follow its declared dependencies; this section does not replace those methods or require loading them all.
96
83
 
97
- Once evidence supports the result, silently self-review through the producing method and correct covered defects. This does not accept the unit or authorize follow-up work.
84
+ ### Discussion And Implementation Readiness
98
85
 
99
- Begin return preparation when the result is available, a stop condition is reached, a governing decision is needed, no useful covered action remains, or fresh user input requires Coordinator attention.
86
+ Under [Discuss](../../skills/discuss/SKILL.md), Coordinator collaborates with the user about the outcome, alternatives, assumptions, and approach. Helper supports that discussion by investigating bounded questions and returning sources, findings, and uncertainty to Coordinator. A substantive technical investigation may instead be commissioned to Executor. Workers do not take over the user conversation or resolve user-owned choices.
100
87
 
101
- ## Executor: Prepare Evidence, Then Return
88
+ WHAT and HOW may be established collectively. Before delegating, know what the next assignment must establish and why; do not require the whole task's solution in advance. One Helper pass may both inform Coordinator's decision and collect the context the eventual producer needs. A request for evidence can be complete even while the decision that depends on that evidence is unresolved.
102
89
 
103
- Executor sees ordinary Pi active context. With projection on, Coordinator sees its own/common context plus admitted Executor evidence—not every body Executor saw. A report, ref, filename, or call envelope is not the underlying result.
90
+ Implementation authorization is not implementation readiness. [Execute Work](../../skills/execute-work/SKILL.md) includes preparing a supported approach before production changes. If relevant mechanisms, callers, constraints, or observing seams are missing, obtain them through the mode-appropriate route. Do not invent a separate mandatory pre-execution phase or restart discussion merely because a local signature needs inspection.
104
91
 
105
- 1. **Reconcile claims and evidence.** Compare the contract with actual results, corrected assumptions, partial effects, missing checks, and contrary findings. Ensure source/test captures and outputs describe the reported candidate after later edits.
106
- 2. **Select what assessment needs.** When projection is on, project every completed skill and instructional-reference read, including the bootstrap read. Add the other missing eligible bodies needed to assess the result. Prefer actual tool results for execution claims and substantive assistant text when that text is the object of judgment.
107
- 3. **Read receipts and correct supported problems.** Preserve valid selections. Resolve bad identities or representations where supported; withdraw unavailable or unnecessary requests only with a reason and retain their material limitations. Removing a ref does not resolve a required evidence gap. Do not silently substitute a summary for a promised original or hide adverse evidence to obtain readiness.
108
- 4. **Submit the actual report.** State the result, evidence and limits, corrected assumptions, partial effects, and reason for return in `freeflow_return(operation: "submit")`. Then stop ordinary assignment work.
92
+ Before substantial dependent work, use [Design for Depth](../../skills/design-for-depth/SKILL.md) and its Implementation Decisions method when unresolved representation, identity, ownership, algorithm, or failure choices could invalidate that work. Coordinator may commission investigation or a proposal before settling governing direction. Give the eventual producer the supported choices, rationale, constraints, and remaining local freedom—not an entire patch to transcribe.
109
93
 
110
- Use known refs directly. Use bounded `freeflow_project inspect` only when a needed identity or selection state is unclear; it discovers metadata, not full source bodies or an exhaustive tool log. Let the harness resolve native dependencies and eligible historical sources. Do not guess refs, reread merely to manufacture them, or inspect after every tool call.
94
+ ### Artifact Production
111
95
 
112
- Select incrementally when useful, then reconcile the final set before submission. Requested evidence is a minimum, not an exclusive allowlist. Do not dump every source or copy raw outputs into the report to evade projection. Select the smallest sufficient set, including governing background and contradictions needed for assessment.
96
+ Use [Write Spec](../../skills/write-spec/SKILL.md), [Write Plan](../../skills/write-plan/SKILL.md), or the appropriate producing method when an artifact is required. Helper can gather and organize material or make settled mechanical updates. When Executor is enabled, delegate substantial separable artifact production to it under a clear brief; Coordinator need not write every important document personally.
113
97
 
114
- No additional discretionary selection is needed when Coordinator already has the evidence, the result is self-contained, or an interrupted/blocked return honestly lacks it. Absence of an explicit request to project does not excuse missing support. With projection off, skip projection tools, not verification or honest reporting.
98
+ Coordinator retains governing judgment and assesses the artifact against accepted intent. It authors directly in helper-only mode, when the user explicitly selects Coordinator authorship, or when the synthesis qualifies for ACT_BOUNDED. Do not decide placement merely because the output is prose rather than code. An artifact may present options or unresolved choices without silently adopting them as accepted policy.
115
99
 
116
- Optional Context Control cleanup may occur after promised evidence is prepared. Account for new reads or changed evidence before submitting. Batch already-decided selection changes and one return last only when the report does not depend on an unread receipt. Never combine new task work with a report that assumes its unseen outcome.
100
+ ### Verification, Review, And Task Memory
101
+
102
+ The producer verifies and self-reviews its work through the owning method. Helper can perform separable checks, validations, and evidence retrieval; Executor can own substantial test design, diagnosis, or audits. Follow [Verify Work](../../skills/verify-work/SKILL.md) to distinguish execution from what the observation proves. Do not substitute an easier observer or change acceptance to obtain a pass.
103
+
104
+ Coordinator judges the returned work through [Review Work](../../skills/review-work/SKILL.md) or [Review Artifact](../../skills/review-artifact/SKILL.md) when that method is needed. Reuse adequate producer verification and self-review. A worker audit in the same session is not independent review merely because another profile performed it; independent review remains a separately selected Workflow activity.
105
+
106
+ Use [Track Work](../../skills/track-work/SKILL.md) for required write-ahead Slice state, factual progress, evidence, decisions, and lifecycle operations. Delegate routine record maintenance to Helper when available; otherwise use the mode-appropriate producer. Workers may preserve actual work and limitations, but must not record their own returned result as Coordinator acceptance. Completed Slice closure follows the acceptance rule below. Task-state changes remain user-controlled.
107
+
108
+ ## Coordinator: Give A Usable Assignment
109
+
110
+ Choose the next coherent result and the worker suited to it. Put the actual contract in `freeflow_delegate(operation: "assign")`, explaining what the worker needs:
111
+
112
+ - the required result, why it matters, and the active method;
113
+ - established facts, accepted direction, and remaining questions;
114
+ - scope, ordering, constraints, permitted effects, and local freedom;
115
+ - evidence needed to understand and assess the result;
116
+ - the return condition, including a changed premise or governing choice.
117
+
118
+ A preparation assignment names what must be learned, not a guessed implementation. A production assignment explains enough of the approach and acceptance to act safely while leaving ordinary engineering to its producer. For a consequential or repeatedly misunderstood property, identify the required behavior, one plausible wrong behavior, and the observation that separates them.
119
+
120
+ Request evidence by purpose before future refs exist. Requested evidence is a minimum; workers also return material discoveries and counterevidence. Explain the conclusions and relationships that must survive transfer. Shared history and provider caching do not convey unspoken direction, and a filename does not establish that its contents are available.
121
+
122
+ Size work to include execution, local checks, expected correction, and return preparation. Shorten an assignment when an unfamiliar seam or uncertain observer could invalidate substantial dependent work. Do not supervise every command or delegate the whole objective merely to avoid later judgment. A negative experiment may complete its assignment.
123
+
124
+ Use `replace` only for supported, quiescent outstanding work whose unit outcome remains valid. State why direction changes, preserve partial effects and uncertainty, and explicitly choose the replacement worker in `both`. Do not replace returned work, or close and recreate a unit to evade unfinished responsibility.
125
+
126
+ ## Worker: Execute And Return At The Useful Boundary
127
+
128
+ Establish the exact contract, assigned worker, constraints, and return condition. Load the producing method and [Action Selection](../../skills/action-selection/SKILL.md) when absent. Follow required direction while choosing ordinary mechanics resourcefully within scope.
129
+
130
+ Helper may reason through supporting work and correct understood local mechanical errors. Do not turn a finding or failed check into unassigned substantive work. Executor may investigate, develop local solutions, implement, verify, and correct within its substantive assignment. Neither worker gains authority from a useful discovery or an available tool.
131
+
132
+ Challenge unsupported premises and report better supported approaches. A governing change alters the accepted outcome, architecture, policy, scope, authority, failure behavior, or evidence requirements. Stop dependent effects before adopting it. Ordinary local choices do not require return merely because a filename, helper function, or step was not prescribed.
133
+
134
+ For unexplained or repeatedly stalled failure, use [Diagnose Failure](../../skills/diagnose-failure/SKILL.md) within scope or return. Distinguish a defective observer, missing evidence, and an invalidated implementation premise. Do not build a subsystem or weaken a requirement just to rescue the chosen approach.
135
+
136
+ Run routine tools directly and put findings in the return report. Do not emit planning labels, tool announcements, or routine progress messages. Return questions requiring the user to Coordinator rather than starting a separate discussion.
137
+
138
+ Verify the actual candidate and self-review through the producing method. Preserve failed, stale, incomplete, and inconclusive evidence. If a test changes, expose the difference in what its old and new setup and assertions establish; a valid local assertion repair can still displace another required scenario.
139
+
140
+ Begin return preparation when the result is ready, its stop condition is reached, no useful covered work remains, or fresh user input requires Coordinator attention. Do not stop after each intermediate command. Do not continue into a different responsibility merely to avoid a handoff. A worker's self-review or `completed` return is not permission to close the Slice or accept its own work.
141
+
142
+ ## Worker: Prepare Evidence, Then Return
143
+
144
+ Helper and Executor share ordinary active history, including each other's work. Do not create worker-to-worker projections or context manifests. Reuse applicable sources and observations while preserving who actually produced them.
145
+
146
+ With projection on, Coordinator receives its own/common context plus admitted worker evidence—not every body the workers saw. Select enough original context for understanding and judgment, not the execution trail. Unknown authorship stays unknown. A shared source, report, ref, filename, call envelope, or nearby result is not automatically the evidence for a claim.
147
+
148
+ Prepare evidence when the assignment reaches its return boundary, including a required stop or interruption—not after each tool call or skill read. Normally, finish the bounded work, select the needed evidence directly, check the receipt, and submit.
149
+
150
+ 1. **Reconcile the result.** Compare the contract with actual work, changed assumptions, partial effects, missing checks, and contrary findings. Ensure source, artifact, and test captures describe the reported candidate after any later edits.
151
+ 2. **Choose useful context.** Start with Coordinator's requests and what it already has. Add governing background, material discoveries, and counterevidence needed to assess the result or choose what follows. Eligibility alone is not a reason to select a source.
152
+ 3. **Add the supporting bodies.** When projection is on, add skill reads, including the bootstrap and reference parts needed for complete methods. Reuse retained methods and existing selections. Add the original task-evidence bodies needed for assessment, preserving producer attribution when selecting another worker's work. Skill reads are instructional context; this does not mean adding all tool results. Group the needed refs in the return-preparation selection rather than adding them after each read.
153
+ 4. **Check receipts.** Resolve supported identity or representation problems. Withdraw unavailable or unnecessary requests only with reasons, preserving material gaps. Removing a selection does not resolve a required evidence gap. Do not rerun work or reread files solely to manufacture a selectable receipt.
154
+ 5. **Submit the actual communication.** Use `freeflow_return(operation: "submit")` for the result, evidence and limits, changed assumptions, partial effects, and reason for return. Attached recovery uses `supplement` instead. After saving either communication, stop ordinary task or recovery-read work.
155
+
156
+ ### Select Known Evidence Directly
157
+
158
+ Use visible source refs and producer labels with `freeflow_project` add. Prefer tool-result bodies for execution claims and exact assistant `#text` when a finding or draft is itself the object of judgment. Plain refs retain whole-native meaning. Let the harness resolve native dependencies and eligible historical sources; do not guess refs.
159
+
160
+ Use `freeflow_project inspect` only when evidence identity, eligibility, representation, or selection state is unclear—for example, locating needed results after a large assignment, resolving a selection problem, or correcting an evidence-related submission failure. Assignment size alone does not require inspection. Choose the relevant scope and continue pagination only while that question remains unresolved. Once the needed refs are found, add them directly; the remaining candidate count is not a work queue. Metadata does not replace source bodies.
161
+
162
+ Reconcile the selection at return preparation; do not maintain it turn by turn. Correct supported receipt problems before submitting, without restarting task work. No new task-evidence selection is needed when Coordinator already has adequate evidence or the result is self-contained. An interrupted return must preserve what is unavailable. With projection off, skip projection tools, not verification or honest reporting.
163
+
164
+ Optional Context Control cleanup follows preparation of promised evidence. If cleanup fails, keep the extra context and continue a valid handoff. Batch already-decided selection changes and one return last only when the report does not depend on an unread receipt. Never combine new task work with a return that assumes its unseen outcome.
117
165
 
118
166
  ### Preserve A Blocked Or Interrupted Return
119
167
 
120
- Do not delay cancellation or a required stop to run another read, test, or retrieval. Preserve available evidence through permitted handoff preparation. If evidence remains unavailable or selection is blocked, save a partial or blocked report with explicit gaps; do not force an unsupported `completed` outcome.
168
+ A required stop takes precedence over another read, test, or retrieval. Prepare an honest partial or blocked return from available evidence; do not force `completed` to obtain delivery.
169
+
170
+ `reportSaved` is not configured, delivered, or assessed. If transfer is blocked, ordinary work remains ended. Correct only the supported handoff problem and use payload-free `freeflow_return(operation: "retry")` for unchanged saved communication. Use `submit` only for a deliberate original-report revision, or `supplement` for recovery communication. Do not resume task work, repeat uncertain effects, or discard adverse evidence to make delivery ready.
171
+
172
+ ## Coordinator: Assess, Adapt, And Authorize Completion
173
+
174
+ Assess the report and evidence already received. Ordinary assessment requires neither routine inspection nor an `assess` call; that operation restores a suspended evidence obligation, not a judgment.
175
+
176
+ For a material claim, compare the accepted property, actual observer, decisive assertions, candidate identity, and result. A confident report or green suite cannot supply a missing link. Keep unsupported required claims open and stop dependent work. Check the actual state before calling something a defect or crediting a new fix: newly tested behavior may already have existed.
177
+
178
+ Also assess your direction. Did it leave a consequential decision implicit, over-constrain the mechanism, choose the wrong observer, or assign the wrong responsibility? Did the evidence enable judgment or mostly reproduce execution noise? Improve the next assignment from that answer; do not commission a cosmetic cleanup round.
179
+
180
+ Choose the next route from the actual gap:
181
+
182
+ - **Supported result:** continue covered work with the appropriate producer, or accept the outcome when its requirements are settled.
183
+ - **Existing evidence omitted:** use supported selection/delivery recovery before another investigation. Absence from your view is not proof that an action never occurred.
184
+ - **Missing or inadequate observation:** request the discriminating evidence without changing the required property.
185
+ - **Supported defect:** assign the correction and affected checks according to its responsibility; a settled mechanical fix may fit Helper, while substantive correction belongs with Executor or Coordinator in helper-only mode.
186
+ - **Invalidated approach or unclear cause:** revise the affected direction or commission diagnosis, rather than repeat an unchanged demand.
187
+ - **User-owned choice:** discuss it before dependent work.
188
+
189
+ Repeated failure needs a changed premise, observer, contract, working set, or mechanism—not lower acceptance, indefinite repair, or an unrequested compute-configuration change. Reuse adequate verification and producer self-review; do not automatically add an independent reviewer or repeat every check.
190
+
191
+ ### Accept Before Recording Completed Slice Closure
192
+
193
+ Under Automatic routing, workers may maintain factual progress and evidence through Track Work while a Slice remains open. They must not close it as completed merely because their assignment ended, their own checks passed, or a return tool accepted their report. Under Manual control, the held profile instead follows ordinary Workflow and Track Work; it does not need a separate Coordinator acceptance.
194
+
195
+ Before authorizing completed Slice closure, Coordinator must assess the Slice's required result and evidence, resolve material contradictions, and confirm its applicable checkpoints are settled. State that judgment in visible communication and explicitly direct the completion writeback. A prior instruction to "run the checks and close if green" cannot substitute for assessment of those unseen results.
121
196
 
122
- `reportSaved` is not configured, delivered, or assessed. If transfer is blocked, ordinary task work remains ended. Correct only the supported handoff problem, then use payload-free `freeflow_return(operation: "retry")` for the unchanged saved report. Use `submit` only for a deliberate report revision. Do not redo the investigation or repeat uncertain effects; reconcile them through supported controls.
197
+ Then delegate the Track Work transition to an appropriate worker, normally Helper when available, or perform it within a permitted direct-work route. The worker records the accepted outcome and limits, applies the lifecycle operation, and checks the resulting record. If new material evidence contradicts the accepted basis, return before closure rather than record a false completion.
123
198
 
124
- ## Coordinator: Assess The Result And Your Direction
199
+ Coordinator checks the bookkeeping result without restarting the accepted implementation review. Combine already-settled maintenance when useful; do not rerun valid checks merely to justify this handoff. Closure leaves the next action explicit and does not automatically select another Slice or change the user-controlled task state.
125
200
 
126
- Assess the report and evidence already received. Ordinary assessment requires neither `inspect` nor `assess`. The `assess` operation restores a suspended assessment's evidence obligation; it does not perform judgment or accept the result.
201
+ Use `freeflow_unit(operation: "close")` only when that unit's outcome and required evidence are supported and applicable contradictions/checkpoints are resolved, or record an authorized cancelled/deferred disposition. Routing-unit closure does not complete a Working Record Slice or task, clear history, or authorize commit, release, deployment, or other delivery. Continue covered work to the agreed user-facing boundary rather than treating an internal handoff as completion.
127
202
 
128
- For a material claim, compare the accepted property, actual observer, decisive assertions, candidate identity, and result. A confident report or green suite cannot supply a missing link. Keep unsupported required claims open and stop dependent work.
203
+ ## Preserve Input, Manual Control, And Continuity
129
204
 
130
- Also ask whether your direction served the user's outcome: did it leave a consequential decision implicit, impose an unnecessary mechanism, choose the wrong observer, or size the assignment poorly? Accept a simpler valid implementation without demanding your preferred style. For a consequential design choice, assess its actual realization, not merely a claim that the spec was followed.
205
+ Under Automatic control, Coordinator owns substantive user interpretation, discussion, decisions, and reporting. New natural-language input, including "continue," goes through Coordinator. If it reaches an already prepared worker request, honor restrictions immediately, stop task work, and return available partial state. Runtime State refreshes are observations, not new user direction.
131
206
 
132
- Reuse adequate verification and Executor self-review. Use [Review Work](../../skills/review-work/SKILL.md) or [Review Artifact](../../skills/review-artifact/SKILL.md) when their judgment method is needed; load it when absent. A separate independent review remains a Workflow decision, not an automatic handoff step.
207
+ Technical retries and native tool results remain within the accepted assignment. `/freeflow resume` explicitly continues eligible unchanged saved work after reconciliation; it does not release a manual hold or reopen ordinary work after a saved return.
133
208
 
134
- Choose the next action from the actual gap:
209
+ A user may hold Coordinator, Helper, or Executor in Manual control. The held profile follows ordinary unsplit Workflow for the authorized work, not its Automatic assignment role; Helper is not restricted to support during a Manual hold. Do not keep a shadow delegation hierarchy, switch automatically, or fabricate an assignment to justify direct work. Preserve any interrupted assignment, partial effects, and unresolved assessment. If the held preset cannot operate, report the limit and leave the control choice to the user.
135
210
 
136
- - **Supported result, covered work remains:** assign the next coherent result.
137
- - **Existing evidence omitted:** seek supported selection/delivery correction before new investigation.
138
- - **Missing or inadequate observation:** request the discriminating evidence, preserving the required property.
139
- - **Supported defect:** explain the correction and affected checks.
140
- - **Invalidated approach or unclear cause:** revise the affected direction or investigate; do not repeat the same demand more forcefully.
141
- - **User-owned choice:** discuss through Workflow or Decision Gate before dependent work.
142
- - **Outcome complete or deliberately stopped:** close with an honest disposition.
211
+ When the user releases Manual control, Coordinator reconciles the current user direction, selected mode, outstanding responsibility, and effects of work performed during the hold before continuing Automatic routing. A release does not silently retarget or accept old work.
143
212
 
144
- Carry supported lessons into later contracts. Add precision where misunderstanding occurred; keep freedom where execution was sound. Repeated failure needs a changed premise, observer, contract, working set, or mechanism—not lower acceptance or an endless repair loop. Changing user-controlled compute configuration remains a separate decision.
213
+ After context loss or uncertain continuity, follow the capability bootstrap cue before task work. Reload missing methods and recover control, mode, profile, contract/report, user direction, partial effects, evidence limits, and stop conditions. When a Working Record exists, use Track Work for complete `full` recovery through the current mode's environment route. An outstanding worker reconstructs and continues its recorded assignment. Preserve existing assignment or assessment responsibility when recovering missing context; do not open a fresh Helper assignment around it. When no existing responsibility needs preservation, Coordinator may delegate record/context gathering to Helper when available. Helper-only mode permits Coordinator's own recovery reads. Do not reopen production or adopt a superseded contract merely because a summary mentions it.
145
214
 
146
- Use `freeflow_unit(close)` as Coordinator only when the required result and evidence are supported and applicable checkpoints and contradictions are resolved, or record an authorized cancelled/deferred outcome without claiming completion. Closing a unit does not complete a Working Record task, delete relevant history, or authorize delivery, commit, release, or deployment. Continue covered work to the user's agreed boundary, not merely to an internal handoff.
215
+ ### Attach Missing-Evidence Recovery To Its Assessment
147
216
 
148
- ## Handle Input, Context, And Recovery
217
+ Outstanding assignments use supported continuation, not attached assessment recovery. For the current returned assessment, Coordinator uses `freeflow_unit(operation: "recover")` with the missing-evidence question and any exact task-file paths needed. Recovery belongs to that assignment's recorded worker, not the worker the present mode would choose for new work. Preserve the unit, assignment, original report, outcome, revision, selections, and assessment.
149
218
 
150
- Under Automatic control, Coordinator owns substantive user interpretation, discussion, decisions, and reporting. New natural-language input, including "continue," goes through Coordinator. If it reaches an already prepared Executor request, honor restrictions immediately, stop task work, and return the available partial state. Runtime State refreshes do not trigger this interruption rule.
219
+ During attached recovery, the worker may select previously exposed evidence and read only exact admitted task paths or packaged Freeflow skill/reference methods. It must not edit, run commands/tests, broaden discovery, or resume ordinary task work. Report stale or unavailable evidence without rerunning historical effects. Use `freeflow_return(operation: "supplement")`; stop reads after saving it. A partial or blocked supplement may deliver communication while the full evidence obligation remains suspended. Payload-free `retry` retries the unchanged saved supplement.
151
220
 
152
- Native tool responses and technical retries continue within the assignment. `/freeflow resume` is an explicit user control for eligible interrupted work after reconciliation, not permission to release a manual hold or resume ordinary work after a saved return. Releasing Manual control returns responsibility for reconciliation to Coordinator.
221
+ Coordinator may use `cancel-recovery` when the lookup is no longer needed. Cancellation preserves the original report and assessment. Deliver the supplement or cancel recovery before `assess`; fresh user input does not settle recovery automatically. Manual control, navigation, and failed delivery retain their precedence.
153
222
 
154
- After context loss or uncertain continuity, recover control, current responsibility, applicable contract/report, user direction, partial effects, evidence limits, and stop conditions. Reload missing methods. When a Working Record exists, follow [Track Work](../../skills/track-work/SKILL.md) for complete `full` recovery and current-source reconciliation; record and evidence reads remain Executor work. Do not combine a superseded stopping instruction with a newer contract.
223
+ Do not simulate recovery by replacing an assignment/report or opening a new unit. A separate recovery assignment is appropriate only when no existing assignment or assessment needs preservation. Use `assess` when a suspended assessment becomes the intended activity again; failed restoration leaves the evidence gap open.
155
224
 
156
- Attach recovery to the existing responsibility. Outstanding assignments recover through their supported continuation. Returned work may use an attached recovery-only phase only if the runtime actually exposes it; otherwise inspect saved communication and stop if insufficient. Do not simulate recovery by replacing the assignment or report. A separate recovery assignment is appropriate only when no existing assignment or assessment needs preservation.
225
+ ### Retain Useful History
157
226
 
158
- Use `freeflow_unit(assess)` when a suspended assessment becomes the intended activity again. Failed restoration leaves the gap open. Suspension pauses additional evidence restoration, not the relevance of ordinary admitted history. Navigation does not roll back files, processes, or task memory; historical instructions do not grant current authority.
227
+ Closure, replacement, return, and attention change responsibility, not the relevance of admitted history. Keep historical work distinct from the current obligation without silently removing it. Suspension pauses additional evidence restoration, not the relevance of already admitted history. Navigation does not roll back files, processes, or task memory; compaction does not justify fabricating source bodies or repeating uncertain effects.
159
228
 
160
- When Context Control is effective, read its method before managing your own view. Either profile may reduce obsolete or redundant material without losing current direction, contrary findings, or promised evidence. Cleanup is optional and never changes the other profile's view, canonical history, or evidence membership. Prepare promised originals first; if cleanup fails, retain the extra context and continue the valid handoff. Do not discard useful communication merely because a unit closed.
229
+ When Context Control is effective, read its method before managing a view. Deliberate cleanup is optional; follow its declared scope rather than assuming it changes another profile's view, canonical history, or evidence membership. Preserve current direction, contrary findings, and promised originals. Do not discard useful communication merely because a unit closed.
161
230
 
162
231
  ## ACT_BOUNDED: Inseparable Judgment And Action
163
232
 
164
- Beyond permitted routing, instructional reads, and view-local context operations, direct Coordinator environment work requires both inseparable judgment/action and a concrete material loss from delegation. Task size, convenience, fewer switches, preference for the stronger model, or failed recovery is insufficient.
233
+ Beyond mode-permitted work or explicitly user-selected artifact authorship, routing controls, instructional reads, and effective view-local controls, direct Coordinator environment work requires both inseparable judgment/action and concrete material loss from delegation. Task size, convenience, fewer switches, preference for premium compute, or failed recovery is insufficient.
165
234
 
166
- Synthesis may qualify when the requested artifact is the governing judgment itself and a decision-complete contract would already contain essentially the artifact. Sensitive result-by-result intervention may also qualify. Separable gathering, routine checking, and ordinary implementation remain delegated.
235
+ Governing-judgment synthesis may qualify when a decision-complete contract would already contain essentially the artifact. Sensitive result-by-result intervention may also qualify. Ordinary separable production belongs with its mode-appropriate producer; do not relabel it as judgment merely to bypass placement. Helper-only Coordinator production needs no exception.
167
236
 
168
- Before acting, state ACT_BOUNDED with the scope, expected result, existing authority, stop condition, inseparable judgment, and delegation loss. Stay within it; end on completion, interruption, context loss, changed applicability, or before delegating again. It grants no permission and does not create, transfer, or close routing responsibility.
237
+ Before acting, state ACT_BOUNDED with its scope, expected result, existing authority, stop condition, inseparable judgment, and delegation loss. Stay within that scope; end on completion, interruption, context loss, changed applicability, or before delegating again. It creates no additional permission, assignment, or acceptance.
169
238
 
170
- Stop applying the automatic split when control becomes Manual or routing becomes inactive. Preserve unfinished responsibility honestly and follow ordinary Workflow.
239
+ Stop applying the Automatic split when control becomes Manual or routing becomes inactive. Preserve unfinished responsibility honestly and follow ordinary Workflow.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "freeflow",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Feedback-based control system for coding agents."
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hassangameryt/freeflow",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Feedback-based control system for coding agents.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { EFFORTS, PROFILES, canonical, isObject } from "./types.js";
1
+ import { DELEGATION_MODES, EFFORTS, PROFILES, canonical, isObject, workersForDelegation } from "./types.js";
2
2
  export const supportsCognitiveRoutingModelRegistry = (host) =>
3
3
  typeof host?.modelRegistry?.find === "function" && typeof host?.modelRegistry?.getApiKeyAndHeaders === "function";
4
4
  export const pairFromProfile = (profile) => ({
@@ -8,24 +8,29 @@ export const pairFromProfile = (profile) => ({
8
8
  });
9
9
  function parseLayer(raw) {
10
10
  if (raw === undefined) return {};
11
- if (!isObject(raw) || Object.keys(raw).some((k) => !["enabled", "projection", "profiles"].includes(k)))
11
+ if (
12
+ !isObject(raw) ||
13
+ Object.keys(raw).some((key) => !["enabled", "delegation", "projection", "profiles"].includes(key))
14
+ )
12
15
  throw new Error(
13
- "Routing requires the new enabled/projection/profiles schema; experimental legacy configuration is not migrated.",
16
+ "Routing requires the enabled/delegation/projection/profiles schema; experimental legacy configuration is not migrated.",
14
17
  );
15
18
  for (const key of ["enabled", "projection"])
16
19
  if (raw[key] !== undefined && typeof raw[key] !== "boolean") throw new Error(`${key} must be boolean.`);
20
+ if (raw.delegation !== undefined && !DELEGATION_MODES.includes(raw.delegation))
21
+ throw new Error("delegation must be executor, helper, or both.");
17
22
  if (raw.profiles !== undefined) {
18
- if (!isObject(raw.profiles) || Object.keys(raw.profiles).some((k) => !PROFILES.includes(k)))
19
- throw new Error("Profiles must be coordinator/executor.");
20
- for (const p of Object.values(raw.profiles)) {
23
+ if (!isObject(raw.profiles) || Object.keys(raw.profiles).some((key) => !PROFILES.includes(key)))
24
+ throw new Error("Profiles must be coordinator, helper, or executor.");
25
+ for (const profile of Object.values(raw.profiles)) {
21
26
  if (
22
- !isObject(p) ||
23
- Object.keys(p).some((k) => !["provider", "model", "thinking"].includes(k)) ||
24
- typeof p.provider !== "string" ||
25
- !p.provider.trim() ||
26
- typeof p.model !== "string" ||
27
- !p.model.trim() ||
28
- !EFFORTS.includes(p.thinking)
27
+ !isObject(profile) ||
28
+ Object.keys(profile).some((key) => !["provider", "model", "thinking"].includes(key)) ||
29
+ typeof profile.provider !== "string" ||
30
+ !profile.provider.trim() ||
31
+ typeof profile.model !== "string" ||
32
+ !profile.model.trim() ||
33
+ !EFFORTS.includes(profile.thinking)
29
34
  )
30
35
  throw new Error("Each profile requires provider, model, and supported thinking.");
31
36
  }
@@ -39,6 +44,8 @@ export async function resolveCognitiveRoutingState(repository, personal, ctx) {
39
44
  enabled: false,
40
45
  effective: false,
41
46
  enabledSource: "default",
47
+ delegation: "executor",
48
+ delegationSource: "default",
42
49
  projection: false,
43
50
  projectionSource: "default",
44
51
  profiles: {},
@@ -55,6 +62,10 @@ export async function resolveCognitiveRoutingState(repository, personal, ctx) {
55
62
  state.enabled = layer.enabled;
56
63
  state.enabledSource = source;
57
64
  }
65
+ if (layer.delegation !== undefined) {
66
+ state.delegation = layer.delegation;
67
+ state.delegationSource = source;
68
+ }
58
69
  if (layer.projection !== undefined) {
59
70
  state.projection = layer.projection;
60
71
  state.projectionSource = source;
@@ -78,7 +89,8 @@ export async function resolveCognitiveRoutingState(repository, personal, ctx) {
78
89
  ...state,
79
90
  blockingReason: { code: "host_unsupported", message: "Required public Pi model registry is unavailable." },
80
91
  };
81
- for (const name of PROFILES) {
92
+ const requiredProfiles = ["coordinator", ...workersForDelegation(state.delegation)];
93
+ for (const name of requiredProfiles) {
82
94
  const profile = state.profiles[name];
83
95
  if (!profile)
84
96
  return { ...state, blockingReason: { code: "profile_missing", message: `Configure the ${name} profile.` } };
@@ -111,10 +123,14 @@ export async function resolveCognitiveRoutingState(repository, personal, ctx) {
111
123
  };
112
124
  }
113
125
  }
114
- if (canonical(state.profiles.coordinator) === canonical(state.profiles.executor))
115
- return {
116
- ...state,
117
- blockingReason: { code: "profiles_identical", message: "Configure distinct effective model/effort pairs." },
118
- };
126
+ for (const worker of workersForDelegation(state.delegation))
127
+ if (canonical(state.profiles.coordinator) === canonical(state.profiles[worker]))
128
+ return {
129
+ ...state,
130
+ blockingReason: {
131
+ code: "profiles_identical",
132
+ message: `Configure distinct Coordinator and ${worker} model/effort pairs.`,
133
+ },
134
+ };
119
135
  return { ...state, effective: true, blockingReason: { code: "", message: "" } };
120
136
  }