diff --git a/docs/flow.md b/docs/flow.md
new file mode 100644
index 0000000..8b5caca
--- /dev/null
+++ b/docs/flow.md
@@ -0,0 +1,189 @@
+# Input → Output flow
+
+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 scored and dispatched.
+
+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.
+
+---
+
+## Main pipeline
+
+```mermaid
+flowchart TD
+ IN["Input
REPL text · gateway DM · dashboard submit"] --> SUB["Scheduler.submit_request()
create Request, trace 'submit'"]
+
+ SUB --> BUSY{"current process?"}
+
+ %% ---------- idle path ----------
+ BUSY -- "idle" --> SCORE["SemIf score
phase 'score'
How urgent is this?"]
+ SCORE --> DISPATCH
+
+ %% ---------- busy path ----------
+ BUSY -- "busy" --> INTERRUPT["SemIf choice
phase 'choice'
may this interrupt?"]
+ INTERRUPT -- "defer" --> SCORE2["SemIf score
phase 'score'"]
+ SCORE2 --> PUSH["UrgencyQueue.push
max-heap: weight desc, FIFO seq
age pulls low items toward 1.0"]
+ PUSH -- "full" --> REJECT["Output: rejected
'queue is full'"]
+ PUSH -- "ok" --> QUEUED["Output: queued
urgency label + weight"]
+ QUEUED -. "run_queue when idle" .-> DISPATCH
+
+ INTERRUPT -- "interrupt" --> PREEMPT["Abandon pending run
requeue previous at its weight
trace 'preempted'"]
+ PREEMPT --> DISPATCH["Scheduler._dispatch()"]
+
+ %% ---------- navigation ----------
+ DISPATCH --> NAV["navigate()
descend tree, one SemIf choice per level"]
+
+ NAV --> CAT["SemIf choice
phase 'navigate:category'
options = categories + descriptions
+ create_category"]
+
+ CAT --> CATWIN{"winner =
create_category
or tree empty?"}
+ CATWIN -- "yes" --> CREATECAT["CreateCategory"]
+ CATWIN -- "no" --> CATFIT["SemIf choice
phase 'navigate:category_scope'
P covers >= category_tau?"]
+ CATFIT -- "rejected" --> CREATECAT
+ CATFIT -- "covers" --> CANNED{"category in
CANNED_CATEGORIES?"}
+
+ CANNED -- "yes (response)" --> CANNEDLEAF["_navigate_canned
phase 'navigate:response'
closed canned reply tree"]
+ CANNEDLEAF --> RUN["_run_skill()"]
+
+ CANNED -- "no" --> 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"]
+ SOLE --> PICK
+
+ PICK --> INTENT["SemIf choice
phase 'navigate:intent'
P same >= intent_tau?
sole reuse-vs-create guard"]
+ INTENT -- "different" --> CREATESKILL
+ INTENT -- "same" --> RUN
+
+ CREATECAT --> AUTHORING(["authoring pipeline
see below"])
+ CREATESKILL --> 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"]
+
+ RESOLVE --> UNRES{"contract variable
unresolved?"}
+ UNRES -- "yes" --> PAUSE1["Output: needs_input
pre_act pause
ask one variable"]
+ PAUSE1 -. "answer() bypasses gate" .-> RECORD["SemIf choice
phase 'config:record'
record as config vs ask each fire"]
+ RECORD --> RESOLVE
+
+ UNRES -- "no" --> ACT["skill.act(ctx, request)
REAL action via stdlib transport
values from ctx.config"]
+ 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?"}
+ 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"]
+
+ 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
+
+ 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 CREATECAT,CREATESKILL,AUTHORING author;
+```
+
+---
+
+## Authoring pipeline (create / repair)
+
+Entered from `CreateCategory`, `CreateSkill`, or a confirmed repair. Runs in
+background single-slot workers so the main gate stays free.
+
+```mermaid
+flowchart TD
+ START(["CreateCategory / CreateSkill / repair_skill"]) --> DRAFT["single-slot llm worker
DraftAuthor queue"]
+
+ 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 -- "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"]
+
+ REGISTER["register stub in registry + tree
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"]
+
+ 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
+
+ BODY["generate_skill_body()
or regenerate_skill_body() for repair
SKILL.md + bridge catalog
declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice
phase 'authoring:fidelity'
accept / reconsider
+ static integration_findings"]
+ FID -- "reconsider" --> BODY
+ FID -- "accept" --> CONTRACT["parse_contract()
read body's CONTRACT constant"]
+
+ CONTRACT --> CFG["SemIf choice per variable
phase 'config:search'
global -> category -> skill"]
+ CFG --> TEST["generate_skill_tests()
hermetic mechanics test"]
+ 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"]
+
+ 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 "]
+ BODY -. "CodegenError / ValueError" .-> FAIL
+ RUNTEST -. "budget exhausted" .-> FAIL
+
+ 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;
+```
+
+---
+
+## Reading the path
+
+| Stage | Decision (SemIf) | Phase logged | Output |
+| --- | --- | --- | --- |
+| Intake, idle | urgency | `score` | weight → dispatch |
+| Intake, busy | interrupt? | `choice` | preempt or queue |
+| Category | which category | `navigate:category` | category / create |
+| Category scope | does it cover? | `navigate:category_scope` | descend / create |
+| Canned | which reply | `navigate:response` | canned line |
+| Leaf | which skill | `navigate:leaf` | skill |
+| Intent guard | same action? | `navigate:intent` | run / create |
+| 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 |
+| Repair | how to recover? | `repair:choice` | offer |
+| Fidelity | real action? | `authoring:fidelity` | accept / rewrite |
+| Config search | where is the value? | `config:search` | auto-populate |
+| Test regen | code or test? | `codegen_regen` | regenerate |
+
+**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.