From 4e70a5889e5747d20d836c9f2664e8256c5b7829 Mon Sep 17 00:00:00 2001 From: Gabby Morgan Date: Wed, 7 Oct 2026 04:02:37 +0000 Subject: [PATCH] docs: update flow diagrams to current state flow-main.svg and flow-authoring.svg were stale (authoring from Oct 2, main predating the actionability guard and the Oct 6-7 changes). flow-main: - intake names all front ends (REPL, gateway DM: SimpleX/LXMF/voice, dashboard) - deterministic meta-command route (parse_meta_command -> housekeeping) ahead of navigation - actionability guard at the top of navigation; the category softmax offers only real categories + create_category (response is no longer an option) - confident-winner bypass of the scope/intent confirms (softmax_bypass_tau) - intent guard, hard-locked category shortcut, new-skill lock gate, awaiting_skill_body guard - empty/definitive result counts as success; canned and deterministic categories skip assessment; act-raises -> repair - structured SchedulerReply output flow-authoring: - split entries: create (draft worker) vs repair/regen/restart (straight to the codegen worker) - approval "no front end" aborts; registration seeds locks.new_skill - skill_writing/skill_ready traces, regen reason kinds, cancel_build path flow.md source, prose, and reading-path table updated to match. --- docs/flow-authoring.svg | 4 +- docs/flow-main.svg | 4 +- docs/flow.md | 145 +++++++++++++++++++++++++--------------- 3 files changed, 95 insertions(+), 58 deletions(-) diff --git a/docs/flow-authoring.svg b/docs/flow-authoring.svg index 122f09c..99ee0cd 100644 --- a/docs/flow-authoring.svg +++ b/docs/flow-authoring.svg @@ -1,4 +1,4 @@ -

category

skill

no / already approved

yes

approved

denied / timeout / no front end

category

skill

answers / timeout

reconsider (once)

accept

fail

pass

CodegenError / ValueError

budget exhausted

cancel queued or in-flight write

CreateCategory / CreateSkill

single-slot llm worker
DraftAuthor queue

repair_skill / regen_skill / restart_skill

single-slot codegen worker
SkillWrite queue
leaf.writing = true, trace 'skill_writing'

category or skill?

generate_category()
title + description

generate_skill()
title + description

creation_approval
on? (default off)

register stub in registry + tree
seed category config (locks.new_skill)
trace 'category_created' / 'skill_created'

Output: approval prompt
REPL / dashboard / gateway
deny or timeout aborts

Output: creation aborted
nothing registered, not re-dispatched

chain into skill job
approved=true

generate_elicitation()
implementation questions + integration hint

Output: questions
posted one at a time
answer_timeout per question

generate_skill_body()
or regenerate_skill_body() for
repair / fidelity / test / manual regen
CODEGEN.md + bridge catalog
declares INTEGRATION + flat CONTRACT

SemIf choice
phase 'authoring:fidelity'
accept / reconsider
+ static integration_findings

parse_contract()
read body's CONTRACT constant

SemIf choice per variable
phase 'config:search'
global -> category -> skill

generate_skill_tests()
hermetic mechanics test

run_skill_test()
subprocess in skill folder

SemIf choice
phase 'codegen_regen'
regenerate code / test
bounded by test_max_attempts

materialize_skill()
write body + contract to data/skills/
hot-merge into tree, trace 'skill_ready'

requeue original request
meta awaiting_skill_body
trace 'skill_requeued'

back to main pipeline
re-runs navigation onto new leaf

Output: skill_write_failed
leaf stays a restartable stub
restart category.skill

cancel_build meta skill
(housekeeping / CLI / dashboard)

Output: build cancelled
discard output, delete half-built leaf

\ No newline at end of file diff --git a/docs/flow-main.svg b/docs/flow-main.svg index 0f607f9..5b6efc3 100644 --- a/docs/flow-main.svg +++ b/docs/flow-main.svg @@ -1,4 +1,4 @@ -

idle

busy

full

ok

run_queue when idle

yes

no

non-action

request

yes

no

yes (decisive)

no (unsure)

rejected

covers

none

one

many

yes

no

yes (decisive)

no (unsure)

same

different

locked

open

yes

no

writing

stub (no body)

ready

yes

answer() bypasses queue

no

yes

answer()

no

yes

no

retry

complete

user confirms

act raises

canned / deterministic category skips assess

Input
REPL text · gateway DM (SimpleX · LXMF · voice) · dashboard submit

Scheduler.submit_request()
create Request, trace 'submit'

current process?

parse_meta_command()
explicit housekeeping command?

RequestQueue.push
FIFO, bounded

Output: rejected
'queue is full'

Output: queued

run housekeeping leaf
trace 'meta_command'
deterministic; skips navigation

_run_skill()
execute the leaf

navigate()
descend tree, one SemIf choice per level

SemIf choice
phase 'navigate:actionability'
P non_action >= action_tau?

_navigate_canned
phase 'navigate:response'
closed canned reply tree

SemIf choice
phase 'navigate:category'
options = real categories +
descriptions + create_category

create_category win
or no categories?

CreateCategory

winner prob >=
softmax_bypass_tau?

skills in category?

SemIf choice
phase 'navigate:category_scope'
P covers >= category_tau?

CreateSkill

sole skill
softmax skipped

SemIf choice
phase 'navigate:leaf'
options = existing skills only

picked skill
+ leaf_softmax_prob

hard-locked category?
(housekeeping)

winner prob >=
softmax_bypass_tau?

SemIf choice
phase 'navigate:intent'
P same >= intent_tau?

category locked to
new skills?

Output: error
'new-skill creation is locked'

meta
awaiting_skill_body?

Output: error
'body still being written;
restart category.skill'

authoring pipeline
see below

leaf status?

Output: error
'body still being written'

Output: error
'no body yet;
restart category.skill'

SkillRunner.run()
resolve tiered config
global -> category -> skill

contract variable
unresolved?

Output: needs_input
pre_act pause
ask one variable

SemIf choice
phase 'config:record'
record as config vs ask each fire

skill.act(ctx, request)
REAL action via stdlib transport
values from ctx.config

act asks for input?

Output: needs_input
act pause

SemIf choice
phase 'assess:outcome'
P success >= tau?
a definitive empty result counts as success

success?

deterministic summary
category.name: ok/failed - action_log

SemIf choice
phase 'assess:requeue'
complete vs retry

requeue original request
bounded by max_reentries

SemIf choice
phase 'repair:choice'
retry / repair_skill / ask_user / no_repair

Output: ran
SchedulerReply (run_id, skill_ref, result)
REPL · gateway reply · dashboard trace

Output: repair offer
surfaced in REPL/dashboard/gateway

\ No newline at end of file diff --git a/docs/flow.md b/docs/flow.md index ffdd5cb..4a4cc30 100644 --- a/docs/flow.md +++ b/docs/flow.md @@ -3,12 +3,14 @@ How one input travels through the agent. Every diamond marked **SemIf** is a real decision-engine call that is logged as a training row; the LLM only ever *generates* (skill drafts, bodies, questions). There is no up-front -handle/ignore gate — every input is dispatched. +handle/ignore gate — every input is dispatched, and an explicit housekeeping +command is routed deterministically before navigation. -The diagram is split in two: the **main pipeline** (intake → navigation → run → -output) and the **authoring pipeline** (what happens when navigation decides a -category or skill does not exist yet). Authoring is asynchronous: the main gate -is freed immediately and the original request is re-queued once the body lands. +The diagram is split in two: the **main pipeline** (intake → dispatch → +navigation → run → output) and the **authoring pipeline** (what happens when +navigation decides a category or skill does not exist yet). Authoring is +asynchronous: the main gate is freed immediately and the original request is +re-queued once the body lands. Rendered SVG: [flow-main.svg](flow-main.svg) · [flow-authoring.svg](flow-authoring.svg) @@ -18,52 +20,69 @@ Rendered SVG: [flow-main.svg](flow-main.svg) · [flow-authoring.svg](flow-author ```mermaid flowchart TD - IN["Input
REPL text · gateway DM · dashboard submit"] --> SUB["Scheduler.submit_request()
create Request, trace 'submit'"] + IN["Input
REPL text · gateway DM (SimpleX · LXMF · voice) · dashboard submit"] --> SUB["Scheduler.submit_request()
create Request, trace 'submit'"] SUB --> BUSY{"current process?"} %% ---------- idle path ---------- - BUSY -- "idle" --> DISPATCH["Scheduler._dispatch()"] + BUSY -- "idle" --> META{"parse_meta_command()
explicit housekeeping command?"} %% ---------- busy path ---------- BUSY -- "busy" --> PUSH["RequestQueue.push
FIFO, bounded"] PUSH -- "full" --> REJECT["Output: rejected
'queue is full'"] PUSH -- "ok" --> QUEUED["Output: queued"] - QUEUED -. "run_queue when idle" .-> DISPATCH + QUEUED -. "run_queue when idle" .-> META - %% ---------- navigation ---------- - DISPATCH --> NAV["navigate()
descend tree, one SemIf choice per level"] + %% ---------- dispatch ---------- + META -- "yes" --> HK["run housekeeping leaf
trace 'meta_command'
deterministic; skips navigation"] + HK --> RUN["_run_skill()
execute the leaf"] + META -- "no" --> NAV["navigate()
descend tree, one SemIf choice per level"] - NAV --> CAT["SemIf choice
phase 'navigate:category'
options = categories + descriptions
+ create_category"] + %% ---------- actionability guard (top of navigation) ---------- + NAV --> ACTG{"SemIf choice
phase 'navigate:actionability'
P non_action >= action_tau?"} + ACTG -- "non-action" --> CANNEDLEAF["_navigate_canned
phase 'navigate:response'
closed canned reply tree"] + CANNEDLEAF --> RUN + ACTG -- "request" --> CAT["SemIf choice
phase 'navigate:category'
options = real categories +
descriptions + create_category"] - CAT --> CATWIN{"winner =
create_category
or tree empty?"} + %% ---------- category selection ---------- + CAT --> CATWIN{"create_category win
or no categories?"} CATWIN -- "yes" --> CREATECAT["CreateCategory"] - CATWIN -- "no" --> CATFIT["SemIf choice
phase 'navigate:category_scope'
P covers >= category_tau?"] + CATWIN -- "no" --> CATCONF{"winner prob >=
softmax_bypass_tau?"} + CATCONF -- "yes (decisive)" --> HASSKILLS + CATCONF -- "no (unsure)" --> CATFIT["SemIf choice
phase 'navigate:category_scope'
P covers >= category_tau?"] CATFIT -- "rejected" --> CREATECAT - CATFIT -- "covers" --> CANNED{"category in
CANNED_CATEGORIES?"} + CATFIT -- "covers" --> HASSKILLS - CANNED -- "yes (response)" --> CANNEDLEAF["_navigate_canned
phase 'navigate:response'
closed canned reply tree"] - CANNEDLEAF --> RUN["_run_skill()"] - - CANNED -- "no" --> HASSKILLS{"skills in
category?"} + %% ---------- leaf selection ---------- + HASSKILLS{"skills in category?"} HASSKILLS -- "none" --> CREATESKILL["CreateSkill"] HASSKILLS -- "one" --> SOLE["sole skill
softmax skipped"] HASSKILLS -- "many" --> LEAF["SemIf choice
phase 'navigate:leaf'
options = existing skills only"] - LEAF --> PICK["picked skill"] + LEAF --> PICK["picked skill
+ leaf_softmax_prob"] SOLE --> PICK - PICK --> INTENT["SemIf choice
phase 'navigate:intent'
P same >= intent_tau?
sole reuse-vs-create guard"] - INTENT -- "different" --> CREATESKILL + %% ---------- reuse vs create ---------- + PICK --> HARD{"hard-locked category?
(housekeeping)"} + HARD -- "yes" --> RUN + HARD -- "no" --> INTENTBYP{"winner prob >=
softmax_bypass_tau?"} + INTENTBYP -- "yes (decisive)" --> RUN + INTENTBYP -- "no (unsure)" --> INTENT["SemIf choice
phase 'navigate:intent'
P same >= intent_tau?"] INTENT -- "same" --> RUN + INTENT -- "different" --> CREATESKILL - CREATECAT --> AUTHORING(["authoring pipeline
see below"]) - CREATESKILL --> AUTHORING + CREATESKILL --> LOCK{"category locked to
new skills?"} + LOCK -- "locked" --> BLOCKED["Output: error
'new-skill creation is locked'"] + LOCK -- "open" --> BODYQ{"meta
awaiting_skill_body?"} + BODYQ -- "yes" --> PENDINGW["Output: error
'body still being written;
restart category.skill'"] + BODYQ -- "no" --> AUTHORING(["authoring pipeline
see below"]) + + CREATECAT --> AUTHORING %% ---------- run ---------- - RUN --> WRITING{"leaf still
writing?"} - WRITING -- "yes" --> PENDING["Output: error
'body still being written'"] - WRITING -- "no (noop stub)" --> NOOP["Output: error
'no body yet; restart '"] - WRITING -- "runnable" --> RESOLVE["SkillRunner.run()
resolve tiered config
global -> category -> skill"] + RUN --> WRITING{"leaf status?"} + WRITING -- "writing" --> PENDING["Output: error
'body still being written'"] + WRITING -- "stub (no body)" --> NOOP["Output: error
'no body yet;
restart category.skill'"] + WRITING -- "ready" --> RESOLVE["SkillRunner.run()
resolve tiered config
global -> category -> skill"] RESOLVE --> UNRES{"contract variable
unresolved?"} UNRES -- "yes" --> PAUSE1["Output: needs_input
pre_act pause
ask one variable"] @@ -71,33 +90,32 @@ flowchart TD RECORD --> RESOLVE UNRES -- "no" --> ACT["skill.act(ctx, request)
REAL action via stdlib transport
values from ctx.config"] - ACT --> ACTNI{"act asks
for input?"} + ACT --> ACTNI{"act asks for input?"} ACTNI -- "yes" --> PAUSE2["Output: needs_input
act pause"] PAUSE2 -. "answer()" .-> ACT - ACTNI -- "no" --> ASSESS %% ---------- assessment ---------- - ASSESS["SemIf choice
phase 'assess:outcome'
P success >= tau?"] --> OK{"success?"} + ASSESS["SemIf choice
phase 'assess:outcome'
P success >= tau?
a definitive empty result counts as success"] --> OK{"success?"} OK -- "yes" --> SUMMARY OK -- "no" --> REQ["SemIf choice
phase 'assess:requeue'
complete vs retry"] REQ -- "retry" --> REQUEUE["requeue original request
bounded by max_reentries"] REQUEUE -.-> PUSH REQ -- "complete" --> REPAIR - SUMMARY["deterministic summary
category.name: ok/failed - action_log"] --> OUT1["Output: ran
REPL print · gateway reply · dashboard trace"] + SUMMARY["deterministic summary
category.name: ok/failed - action_log"] --> OUT1["Output: ran
SchedulerReply (run_id, skill_ref, result)
REPL · gateway reply · dashboard trace"] REPAIR["SemIf choice
phase 'repair:choice'
retry / repair_skill / ask_user / no_repair"] --> REPAIROUT["Output: repair offer
surfaced in REPL/dashboard/gateway"] REPAIROUT -. "user confirms" .-> AUTHORING - %% ---------- canned shortcut ---------- - RUN -. "canned category skips assess" .-> SUMMARY + ACT -. "act raises" .-> REPAIR + RUN -. "canned / deterministic category skips assess" .-> SUMMARY classDef semfill fill:#e8f0fe,stroke:#4285f4,stroke-width:2px; classDef output fill:#fce8e6,stroke:#d93025; classDef author fill:#e6f4ea,stroke:#34a853; - class SCORE,SCORE2,INTERRUPT,CAT,CATFIT,LEAF,INTENT,ASSESS,REQ,REPAIR,RECORD semfill; - class REJECT,QUEUED,PENDING,NOOP,PAUSE1,PAUSE2,OUT1,REPAIROUT output; + class CAT,CATFIT,ACTG,LEAF,INTENT,ASSESS,REQ,REPAIR,RECORD semfill; + class REJECT,QUEUED,PENDING,NOOP,PENDINGW,BLOCKED,PAUSE1,PAUSE2,OUT1,REPAIROUT output; class CREATECAT,CREATESKILL,AUTHORING author; ``` @@ -105,37 +123,40 @@ flowchart TD ## Authoring pipeline (create / repair) -Entered from `CreateCategory`, `CreateSkill`, or a confirmed repair. Runs in -background single-slot workers so the main gate stays free. +Entered from `CreateCategory`, `CreateSkill`, or a confirmed repair / regen / +restart. Runs in background single-slot workers so the main gate stays free. +Only a *create* asks the small `llm` model for a title + description; a +repair/regen/restart reuses the existing stub and goes straight to the codegen +worker. ```mermaid flowchart TD - START(["CreateCategory / CreateSkill / repair_skill"]) --> DRAFT["single-slot llm worker
DraftAuthor queue"] + START(["CreateCategory / CreateSkill"]) --> DRAFT["single-slot llm worker
DraftAuthor queue"] + DIRECT(["repair_skill / regen_skill / restart_skill"]) --> WRITE - DRAFT --> GEN{"category
or skill?"} + DRAFT --> GEN{"category or skill?"} GEN -- "category" --> GC["generate_category()
title + description"] GEN -- "skill" --> GS["generate_skill()
title + description"] GC --> APPROVE GS --> APPROVE - APPROVE{"creation_approval
on?"} + APPROVE{"creation_approval
on? (default off)"} APPROVE -- "no / already approved" --> REGISTER APPROVE -- "yes" --> PROMPT["Output: approval prompt
REPL / dashboard / gateway
deny or timeout aborts"] PROMPT -- "approved" --> REGISTER - PROMPT -- "denied / timeout" --> ABORT["Output: creation aborted
nothing registered, not re-dispatched"] + PROMPT -- "denied / timeout / no front end" --> ABORT["Output: creation aborted
nothing registered, not re-dispatched"] - REGISTER["register stub in registry + tree
trace 'category_created' / 'skill_created'"] + REGISTER["register stub in registry + tree
seed category config (locks.new_skill)
trace 'category_created' / 'skill_created'"] REGISTER -- "category" --> CHAIN["chain into skill job
approved=true"] CHAIN --> DRAFT - REGISTER -- "skill" --> WRITE["single-slot codegen worker
SkillWrite queue
leaf.writing = true"] + REGISTER -- "skill" --> WRITE["single-slot codegen worker
SkillWrite queue
leaf.writing = true, trace 'skill_writing'"] - WRITE --> ELICIT["generate_elicitation()
implementation questions +
integration hint"] + WRITE --> ELICIT["generate_elicitation()
implementation questions + integration hint"] ELICIT --> QS["Output: questions
posted one at a time
answer_timeout per question"] - QS -- "answers" --> BODY - QS -- "timeout" --> BODY + QS -- "answers / timeout" --> BODY - BODY["generate_skill_body()
or regenerate_skill_body() for repair
CODEGEN.md + bridge catalog
declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice
phase 'authoring:fidelity'
accept / reconsider
+ static integration_findings"] - FID -- "reconsider" --> BODY + BODY["generate_skill_body()
or regenerate_skill_body() for
repair / fidelity / test / manual regen
CODEGEN.md + bridge catalog
declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice
phase 'authoring:fidelity'
accept / reconsider
+ static integration_findings"] + FID -- "reconsider (once)" --> BODY FID -- "accept" --> CONTRACT["parse_contract()
read body's CONTRACT constant"] CONTRACT --> CFG["SemIf choice per variable
phase 'config:search'
global -> category -> skill"] @@ -143,20 +164,22 @@ flowchart TD TEST --> RUNTEST["run_skill_test()
subprocess in skill folder"] RUNTEST -- "fail" --> REGEN["SemIf choice
phase 'codegen_regen'
regenerate code / test
bounded by test_max_attempts"] REGEN --> BODY - RUNTEST -- "pass" --> MAT["materialize_skill()
write body + contract to data/skills/
hot-merge into tree"] + RUNTEST -- "pass" --> MAT["materialize_skill()
write body + contract to data/skills/
hot-merge into tree, trace 'skill_ready'"] MAT --> REQ["requeue original request
meta awaiting_skill_body
trace 'skill_requeued'"] --> BACK(["back to main pipeline
re-runs navigation onto new leaf"]) - FAIL["Output: skill_write_failed
leaf stays a restartable stub
restart "] + FAIL["Output: skill_write_failed
leaf stays a restartable stub
restart category.skill"] BODY -. "CodegenError / ValueError" .-> FAIL RUNTEST -. "budget exhausted" .-> FAIL + CANCEL["cancel_build meta skill
(housekeeping / CLI / dashboard)"] -. "cancel queued or in-flight write" .-> CANCELLED["Output: build cancelled
discard output, delete half-built leaf"] + classDef semfill fill:#e8f0fe,stroke:#4285f4,stroke-width:2px; classDef output fill:#fce8e6,stroke:#d93025; classDef author fill:#e6f4ea,stroke:#34a853; class FID,CFG,REGEN semfill; - class PROMPT,ABORT,QS,FAIL output; - class START,BACK,MAT,REQ author; + class PROMPT,ABORT,QS,FAIL,CANCELLED output; + class START,DIRECT,BACK,MAT,REQ author; ``` --- @@ -167,11 +190,13 @@ flowchart TD | --- | --- | --- | --- | | Intake, idle | — (no decision) | — | dispatch immediately | | Intake, busy | — (no decision) | — | FIFO queue (arrival order) | +| Meta command | — (no decision) | — | route to housekeeping leaf (`meta_command`) | +| Actionability | request or not? | `navigate:actionability` | canned reply / category softmax | | Category | which category | `navigate:category` | category / create | -| Category scope | does it cover? | `navigate:category_scope` | descend / create | +| Category scope | does it cover? | `navigate:category_scope` | descend / create (skipped when decisive) | | Canned | which reply | `navigate:response` | canned line | | Leaf | which skill | `navigate:leaf` | skill | -| Intent guard | same action? | `navigate:intent` | run / create | +| Intent guard | same action? | `navigate:intent` | run / create (skipped when decisive) | | Config record | record or ask? | `config:record` | persisted / per-fire | | Outcome | did it succeed? | `assess:outcome` | ok / failed | | Requeue | complete or retry? | `assess:requeue` | done / requeue | @@ -183,3 +208,15 @@ flowchart TD **The three terminal outputs** are: a run summary (`category.skill: ok/failed — …`), a question the run is waiting on (`needs_input`), or an offer to fix/learn (`repair_offer`) / an authoring acknowledgement for a brand-new capability. + +**Navigation is two-stage with permissive guards.** The actionability guard runs +first and decides whether the input is an actionable request at all; only +non-action input reaches the closed `response` tree, so a request is never +canned. The category softmax then offers the real categories (never `response`) +plus `create_category`, and the leaf softmax offers only the existing skills — +the reuse-vs-create decision is the intent guard. A softmax winner at or above +`softmax_bypass_tau` (default 0.5) is already decisive, so its confirm guard +(scope/intent) is skipped; below it the guard runs and can reject into create. +New-skill creation is also gated deterministically by the per-category +`locks.new_skill` (the `housekeeping` and `response` categories are hard-locked +in code).