Skip to content

I0833 — knowledge nodes and edges read each source once

Time the knowledge stages, then remove the per-file subprocesses in discovery and extraction so that nodes and edges take one pass per source.

DONE wave 1 · p0 · implementation profile · runs alone

Part of M004 — Performance is executable evidence, and the hot path does no canonical work twice.

Objective

Time the knowledge stages, then remove the per-file subprocesses in discovery and extraction so that nodes and edges take one pass per source.

Why

knowledge nodes costs 5.7 s and flattens 146 files on this repository.

Current state

Discovery hashes and flattens per file with a subprocess each.

Desired state

nodes and edges under 1 s on this repository with identical output.

Scope

  • lib/knowledge.sh
  • lib/knowledge.awk
  • test/cases/64_knowledge_discovery.sh
  • test/cases/73_knowledge_nodes.sh
  • test/cases/74_knowledge_edges.sh

Out of scope

  • Changing node identities or edge semantics

Dependencies

What waits on this

Acceptance criteria

  • Byte-identical nodes and edges output before and after
  • Cases 64, 73, 74 and 75 pass unchanged

Validation

  • MJ_TIMING=1 bin/majordomus knowledge nodes
  • bash test/run.sh 73_knowledge_nodes

Evidence required

  • batch_reads

Evidence

coverstypecommandresultat commit
batch_readstestMJ_TIMING=1 bin/majordomus knowledge nodesevery discovered file is hashed by one process instead of one shasum per file, the YAML kinds and the front-matter kinds are flattened by one awk each, the documents' headings and links and the line stores are read by one awk each, the source classes are variables, and the row formatters use a substring instead of a cut per row; on this repository knowledge nodes went from 6.3 s to 0.63 s and edges to 0.62 s with nodes, edges and sources byte-identical except for the hashes of the edited library files; cases 64, 73, 74 and 75 pass unchanged. The same commit computes the tab once for every IFS loop in lib and the site generator, which forked a subshell per row; cases 10, 11, 40, 43, 61 and 66 pass unchangednext

Risk

Identity is a content hash per file; one sha256 subprocess per file remains unless hashing is batched, which shasum -a 256 with many arguments allows.

Timeline

started
2026-09-05T02:40:00Z
verified
2026-09-05T03:05:00Z
completed
2026-09-05T03:05:00Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I0833.yaml. Read it back with majordomus plan show I0833.