Gunnar

mikronova/funnel-core

.nornir/README.md

# funnel-core

> The pure workflow-DAG core of the nornir funnel — events, ids, state,
> topological readiness, history, the Plan-DAG projection, and the kanban-card
> board — with **no** warehouse / iceberg / model / GPU coupling.

Extracted from `nornir/src/funnel/` so both **nornir** (the viz funnel + Plan-DAG
panels) and **ordning-funnel** (idea → case graduation) share one idea→plan→node
DAG without dragging in nornir's storage stack. Everything here is deterministic:
given the same events + query string the output is bit-identical, so every surface
is golden-testable with no warehouse, no clock and no GPU.

<!-- Write any intro prose here. Anything outside the marker blocks below
     is preserved verbatim on every render. -->

## The shape

A funnel is a fold of an append-only [`Event`] log into an in-memory [`Funnel`]:

```text
Event log ──apply──▶ Funnel ──┬─▶ history()          → HistoryItem[]  (intake list)
                              ├─▶ cards_from_funnel() → Card[]         → board() → Board (kanban)
                              ├─▶ query_cards(q)      → Card[]         (YouTrack-style smart query)
                              ├─▶ topo_ready()        → NextStep[]     ("what should I work on next?")
                              ├─▶ simulate_flow()     → FlowSim        (time-step the DAG to done)
                              └─▶ PlanDag::from_funnel → PlanDag       (nodes + edges + topo, viz)
```

Every projection is pure (`&Funnel → value`) and BTree-ordered, so the CLI, the
gRPC server and the viz all render the same bytes and never disagree.

## Benchmarks

<!-- nornir:gen:start:benches -->
<!-- nornir:gen:end:benches -->

The board / smart-query projection (`cards_from_funnel` → `board` → `query_cards`)
and `PlanDag::from_funnel` are the hot paths the funnel UI runs on every render;
they are benched under `bench/` (`nornir bench run funnel-core`) and, for the
Plan-DAG assembly, by nornir's own `nornir.plan_dag_assemble` arm.

## Tests

<!-- Unit / integration / doc tests, enumerated from source via syn. -->
<!-- nornir:gen:start:tests -->
<!-- nornir:gen:end:tests -->

## Dependency graph

<!-- nornir:gen:start:depgraph -->
<!-- nornir:gen:end:depgraph -->

## License

MIT OR Apache-2.0.