mex graph with no subcommand runs an unconditional full rebuild —
runGraph in src/graph/cli-graph.ts:54 calls rebuildGraph() directly.
Running it twice on an unchanged repository rebuilds everything both times.
Measured on honojs/hono @ 4.12.32 (381 indexed files, 13,240 nodes):
| command |
wall clock |
files indexed |
mex graph (cold, no graph) |
65 s |
381 |
mex graph (immediately again, nothing changed) |
367 s |
381 |
mex graph refresh (nothing changed) |
14 s |
0 |
graph status reported fresh throughout the second and third runs.
The 367 s figure is a single observation on a machine that was not isolated, and
the variance in #140 is unexplained — please read it as "another full build",
not as a calibrated number. The reproducible part is the file count: 381 files
re-indexed against a store that status had just called fresh.
Why this is worth changing
refresh already does the freshness check, and on a fresh store it costs 14 s
instead of a full build. The cheap path exists; bare mex graph just does not
route to it.
Suggested behaviour
- Check freshness, as
status already does.
- Already fresh → report and exit without writing.
- Compatible graph with changes → what
refresh does.
- Missing, incompatible or unusable store → full build, as today.
- Keep an explicit escape hatch (
--force, or point at rebuild).
Two corrections to how this was first reported
- The help text no longer reads
Build the code knowledge graph into .mex/graph.db.
On main it is Inspect or explicitly maintain the code knowledge graph, so
the command no longer claims to build. It still does.
- This is a deliberate design decision, not an oversight —
docs/design/graph-freshness-recovery.md:16 states "Bare mex graph is a
compatibility alias." So this is a request to revisit that decision, and the
maintainers may reasonably prefer to keep the alias and redirect users instead.
Before changing it
Several call sites hand mex graph to users as a guaranteed-build recovery
command and would need auditing or repointing at rebuild:
src/graph/errors.ts:19 — recoveryCommand = "mex graph", and the message
"Run mex graph to rebuild it."
src/graph/db/database.ts:79 and :189
src/graph/cli-agent.ts:2030 — GRAPH_UNAVAILABLE remediation
- the Hub's
{ label: "Build graph", command: "mex graph" } remediation
Most of these fire when the graph is missing or unusable, where step 4 already
does a full build — but they should be checked rather than assumed.
mex graphwith no subcommand runs an unconditional full rebuild —runGraphinsrc/graph/cli-graph.ts:54callsrebuildGraph()directly.Running it twice on an unchanged repository rebuilds everything both times.
Measured on
honojs/hono@4.12.32(381 indexed files, 13,240 nodes):mex graph(cold, no graph)mex graph(immediately again, nothing changed)mex graph refresh(nothing changed)graph statusreportedfreshthroughout the second and third runs.The 367 s figure is a single observation on a machine that was not isolated, and
the variance in #140 is unexplained — please read it as "another full build",
not as a calibrated number. The reproducible part is the file count: 381 files
re-indexed against a store that
statushad just called fresh.Why this is worth changing
refreshalready does the freshness check, and on a fresh store it costs 14 sinstead of a full build. The cheap path exists; bare
mex graphjust does notroute to it.
Suggested behaviour
statusalready does.refreshdoes.--force, or point atrebuild).Two corrections to how this was first reported
Build the code knowledge graph into .mex/graph.db.On
mainit isInspect or explicitly maintain the code knowledge graph, sothe command no longer claims to build. It still does.
docs/design/graph-freshness-recovery.md:16states "Baremex graphis acompatibility alias." So this is a request to revisit that decision, and the
maintainers may reasonably prefer to keep the alias and redirect users instead.
Before changing it
Several call sites hand
mex graphto users as a guaranteed-build recoverycommand and would need auditing or repointing at
rebuild:src/graph/errors.ts:19—recoveryCommand = "mex graph", and the message"Run
mex graphto rebuild it."src/graph/db/database.ts:79and:189src/graph/cli-agent.ts:2030—GRAPH_UNAVAILABLEremediation{ label: "Build graph", command: "mex graph" }remediationMost of these fire when the graph is missing or unusable, where step 4 already
does a full build — but they should be checked rather than assumed.