> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Monoflow

> Monoflow 0.4.0 — temporal code flow, cross-database analysis, typed MCP queries, and the bridge from code history to Work Wiki knowledge.

Monoflow is the temporal composition layer in the Mono stack. It joins code structure, git history, document references, file-system events, and saved diffs; writes reusable topic and co-change analysis; and supplies the results consumed by [Work Wiki](/ai-clis/work-wiki) and [NIIA](/ai-clis/niia).

*Documents Monoflow 0.4.0, OpenCLIs build `2026-07-12-192448`.*

*Registry ownership: the canonical `docs_url` is this page, the public product
homepage is `https://monolex.ai`, and Monoflow pairs with Monogram, Monogit,
Monomento, Work Wiki, and NIIA across its evidence graph. Repository ownership
remains `monolex/monolex`; no public source URL is advertised while that
repository is private.*

## Install and identify the contract

```bash theme={null}
openclis install monoflow
monoflow --version
monoflow --help
```

The installed guide is the first command reference. This page adds the commands that are implemented but intentionally omitted from its short command table, the 24-command typed MCP boundary, and the read/write ownership rules.

## Where Monoflow sits

| Direction               | Owner                                  | What Monoflow uses                                                                                             |
| ----------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Upstream                | [Monogram](/ai-clis/monogram/overview) | Current code symbols, call/reference edges, CSS evidence, and cross-language structure                         |
| Upstream                | [Monogit](/ai-clis/monogit)            | Commits, branches, commit symbols, co-change history, and quality-delta inputs                                 |
| Upstream                | [Monomento](/ai-clis/monomento)        | Project document entries, references, and ranked document search                                               |
| Upstream                | NIIA Watcher                           | File create, modify, and delete events from `niia-watcher.db`                                                  |
| Upstream and downstream | [Work Wiki](/ai-clis/work-wiki)        | Monoflow reads `work-wiki-diff.db`; Work Wiki consumes Monoflow search, insights, topics, and owns convergence |
| Downstream              | [NIIA](/ai-clis/niia)                  | Integrated `insights`, `gaps`, `drift`, `chain`, search, and diagnostic surfaces                               |

Monoflow owns the derived analysis database, not the upstream facts:

```text theme={null}
monogram + monogit + monomento + watcher + saved diffs
                         │
                         ▼
                     Monoflow
                         │
                         ▼
       topics · hubs · co-change · linked repositories
                         │
                         ▼
                   Work Wiki · NIIA
```

The per-repository result is stored under `~/.monolex/monoflow/{name}-{hash}.db`. Repositories do not share one analysis result set.

## Normal workflow

```bash theme={null}
# Populate the owners of the upstream facts.
monogram reindex .
monogit index --symbols -n 5000 --all
monomento index . --project

# Compute and publish Monoflow's derived analysis.
monoflow analyze -n 200

# Explore the stored result and the live cross-database views.
monoflow topics
monoflow insights
monoflow search "SessionActor"
monoflow gaps
```

`monoflow analyze --full` is the explicit cascade. It runs Monogram reindex, Monomento project indexing, and Monogit symbol indexing before computing topics, co-change patterns, and the insight cache. Plain `monoflow analyze` does not refresh those upstream owners first.

## Complete 31-command CLI inventory

The inventory below counts canonical feature commands. `help` and `version` are terminal metadata and are not included. “MCP” means the command appears in `monoflow --mcp-schema`; it does not mean the operation is read-only.

### Analysis and search

| Command                   | Alias | MCP | Purpose and important options                                                                                                         |
| ------------------------- | ----- | --: | ------------------------------------------------------------------------------------------------------------------------------------- |
| `monoflow analyze`        | —     | Yes | Compute topics and co-change into `monoflow.db`; `-n`, `--days`, `--window`; `--full` additionally runs the upstream indexing cascade |
| `monoflow topics`         | —     | Yes | Read the latest stored topic run; `--detail <N>`, `--hub <file>`, `--json`                                                            |
| `monoflow topics-live`    | —     | Yes | Compute topic clusters from current inputs without reading the stored topic view; `-n`, `--json`                                      |
| `monoflow map`            | —     | Yes | Render the stored topic relationship map and hub centrality                                                                           |
| `monoflow health`         | —     | Yes | Summarize topic focus, hubs, hidden coupling, and health; `--json`                                                                    |
| `monoflow insights`       | —     | Yes | Produce the complete 21-field cross-database insight report; `--json`                                                                 |
| `monoflow search <query>` | `s`   | Yes | Interleave code, git, document, and diff results on a 0–10 score; `-n`/`--limit`, `--json`                                            |
| `monoflow gaps`           | `g`   | Yes | Focus the insight report on phantoms, documentation gaps, drift, disconnects, stale docs, and API-family drift; `--json`              |

### Focused drills

| Command                     | Alias | MCP | Purpose and important options                                                                                          |
| --------------------------- | ----- | --: | ---------------------------------------------------------------------------------------------------------------------- |
| `monoflow phantom <symbol>` | —     | Yes | Check whether a documented symbol still exists, find its last commit-symbol evidence, doc mentions, and likely renames |
| `monoflow drift <file>`     | —     | Yes | Find former co-change partners that have stopped moving with the target file                                           |
| `monoflow chain <symbol>`   | —     | Yes | Join code definition/callers, git history, and document mentions; `--depth <N>`                                        |

### Temporal and topic views

| Command                       | Alias | MCP | Purpose and important options                                                              |
| ----------------------------- | ----- | --: | ------------------------------------------------------------------------------------------ |
| `monoflow timeline <file>`    | `t`   | Yes | Order git, watcher, document, and diff events for a file; `--days`, `--json`               |
| `monoflow recent`             | `r`   | Yes | Show recent repository activity; `--days`, `-n`, `--json`                                  |
| `monoflow impact <file>`      | `i`   | Yes | Join recent diffs, symbols, callers, and commits into an impact radius; `--days`, `--json` |
| `monoflow correlate`          | `c`   | Yes | Cluster files active in the same time window; `--days`, `--window`, `--json`               |
| `monoflow cochange`           | —     | Yes | Rank files that repeatedly change together; `--days`, `--window`, `--json`                 |
| `monoflow topic-flow`         | `tf`  | Yes | Show when stored topics started, remained active, and ended                                |
| `monoflow timeline-topics`    | `tt`  | Yes | Render stored topics across calendar days                                                  |
| `monoflow file-topics <file>` | `ft`  | Yes | Show a file's topic history; `--date YYYY-MM-DD` opens the detailed day view               |

### Git analytics

| Command                 | Alias | MCP | Purpose and important options                                                  |
| ----------------------- | ----- | --: | ------------------------------------------------------------------------------ |
| `monoflow branches`     | `b`   | Yes | Inspect branch M:N relationships; `--evolution`/`-e`, `--graph`/`-g`, `--json` |
| `monoflow symbol-graph` | `sg`  | Yes | Find branch connections through shared symbols; `--commits`, `--json`          |
| `monoflow heatmap`      | —     | Yes | Rank files by commit/change frequency; `--days`, `-n`, `--json`                |
| `monoflow dashboard`    | `d`   | Yes | Summarize branches, commits, authors, and hot files; `--days`, `--json`        |
| `monoflow authors`      | `a`   | Yes | Show author activity and active-day ownership patterns; `--days`, `--json`     |

### Management, embedded docs, and compatibility

| Command                 | Alias  | MCP | Purpose and important options                                                        |           |                                        |
| ----------------------- | ------ | --: | ------------------------------------------------------------------------------------ | --------- | -------------------------------------- |
| `monoflow weights`      | —      |  No | Read or write quality-delta weights with `key=value`; `--reset` restores defaults    |           |                                        |
| `monoflow link PATH`    | —      |  No | Persist a related repository path; \`--type docs                                     | reference | upstream`; `--remove PATH\` unlinks it |
| `monoflow links`        | —      |  No | List repositories linked to the current repository                                   |           |                                        |
| `monoflow status`       | —      |  No | Report connection, row-count, and staleness evidence for each upstream database      |           |                                        |
| `monoflow docs [topic]` | —      |  No | List or read the agent reference embedded in the installed binary                    |           |                                        |
| `monoflow convergence`  | `conv` |  No | Compatibility redirect; convergence is owned and executed by `work-wiki convergence` |           |                                        |
| `monoflow mcp-schema`   | —      |  No | Print the same typed command document as `--mcp-schema`                              |           |                                        |

The dispatcher also accepts `--help`, `-h`, `help`, `--version`, `-V`, and `version`.

## The 24-command typed MCP surface

```bash theme={null}
monoflow --mcp-schema | jq '.commands | length'  # 24
niia mcp-serve monoflow
```

The schema contains every command marked “Yes” above, in this order:

```text theme={null}
timeline · recent · impact · branches · analyze · map
timeline-topics · topic-flow · file-topics · topics · topics-live · health
correlate · cochange · authors · heatmap · dashboard · symbol-graph
insights · search · gaps · phantom · drift · chain
```

Typed arguments are generated for positional values, options, and flags. The schema currently omits the CLI-only `analyze --full` flag even though `analyze` itself is an MCP-visible command. Treat `monoflow_analyze` as a writer.

## Read and write contract

| Surface                                                                   | Storage behavior                                                                                                                           |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `topics`, `map`, `health`, `timeline-topics`, `topic-flow`, `file-topics` | Open an existing analysis DB; they do not initialize or migrate it and direct the user to `monoflow analyze` when no compatible run exists |
| Bare `monoflow` status probe and embedded NIIA status                     | Read status without creating analysis storage; embedded callers use uncached read-only insight/topic variants                              |
| `monoflow analyze`                                                        | Initializes or migrates analysis storage and holds the exclusive stable writer lock for the complete analysis write                        |
| `monoflow analyze --full`                                                 | Runs three upstream writer CLIs, then performs the Monoflow writer operation                                                               |
| `monoflow weights ...`                                                    | Writes `~/.monolex/config/quality-weights.json`; rerun Monogit symbol indexing to recompute affected history metrics                       |
| `monoflow link ...` / `--remove`                                          | Writes the linked-repository records in the analysis DB                                                                                    |

Project Monomento readiness is counted only while a published generation is ready and held under its project read lease. Pending, tombstoned, missing, or generation-racing document corpora are not reported as ready data.

## The 21 insight fields

`monoflow insights --json` returns 21 evidence families plus the `layer_chaos` aggregate.

| Family                 | Fields                                                                                                                                                                      | What they expose                                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Code and structure     | `css_dead`, `css_missing`, `cross_lang_bridges`, `cross_lang_chains`, `broken_chains`, `call_chain_hubs`, `repo_dependency_graph`                                           | CSS token gaps, cross-language wiring, unresolved call edges, high-connectivity code, and repository structure |
| Documents and coverage | `stale_docs`, `orphan_doc_clusters`, `doc_ref_chains`, `doc_bridges`, `hub_docs`, `doc_code_convergence`, `phantom_symbols`, `topic_knowledge_gaps`, `doc_section_mappings` | Whether documentation follows, connects to, and still names the code it describes                              |
| Git and time           | `naming_drift`, `chain_growth`, `commit_rhythm`, `code_doc_commits`, `temporal_drift`                                                                                       | Convention change, caller growth, work rhythm, code/doc co-commits, and relationships that stopped co-changing |

`layer_chaos` reports CSS, documentation, structural, rhythm, temporal, and overall scores. These are diagnostic aggregates over the evidence above; they are not proof that a particular file is correct or incorrect.

## Quality-delta controls

The quality-delta calculation is owned by Monogit's history model; Monoflow exposes its controls and combines the result with the insight report.

| Signal        | Installed 0.4.0 range | Interpretation                   |
| ------------- | --------------------: | -------------------------------- |
| `temporal`    |        −0.20 to +0.70 | Steady commit gaps               |
| `churn`       |         −0.40 to 0.00 | Repeated edits to the same file  |
| `convergence` |         0.00 to +1.00 | Code and docs in the same commit |
| `divergence`  |         −0.50 to 0.00 | Code moving while docs do not    |
| `commit_type` |        −0.50 to +0.50 | Feature/fix mix                  |
| `topic_focus` |        −0.30 to +0.20 | Topic-switching frequency        |
| `streak`      |         −0.40 to 0.00 | Consecutive fix commits          |
| `thinking`    |         0.00 to +0.20 | Deliberate 10–30 minute gaps     |
| `structural`  |         0.00 to +0.50 | New files and refactors          |

```bash theme={null}
monoflow weights
monoflow weights temporal=0.25 topic_focus=0.15
monoflow weights --reset
```

`scaling` and `exponent` are additional calculation controls accepted by the command. Changing weights does not rewrite past analysis by itself; follow the command's Monogit reindex instruction.

## Continue through the stack

<CardGroup cols={3}>
  <Card title="Turn topics into knowledge coverage" icon="book-open" href="/ai-clis/work-wiki">
    Work Wiki owns project artifacts, sessions, intent, and topic convergence.
  </Card>

  <Card title="Inspect the code evidence" icon="magnifying-glass" href="/ai-clis/monogram/overview">
    Use Monogram when a Monoflow finding needs exact definitions, callers, or coupling proof.
  </Card>

  <Card title="Use the integrated entry point" icon="brain" href="/ai-clis/niia">
    NIIA composes Monoflow findings with memory, orchestration, and system diagnostics.
  </Card>
</CardGroup>
