Saltar al contenido principal

Code graph

The Code graph window draws the code graph of a project mapped by graphify. It never draws the whole graph. You start from one point and open the graph around it, a node at a time. Beside the graph, a panel says who breaks if the node you clicked changes.

The window arrived in 2.2.0.

What graphify is​

graphify is a separate tool, under the Apache-2.0 licence. Run inside a project, it reads the code and writes a map of it to graphify-out/graph.json: the functions, classes and files, and the links between them.

Mnemosyne OS only reads that file and its date. It never runs graphify and never writes into graphify-out. The window credits it at the bottom: Graph made by graphify (Apache-2.0).

With no graph yet, the window shows the two commands to run. The second one runs inside the project folder:

pip install graphifyy
graphify extract . --code-only

Opening it​

Code graph is not on the default rail. Right-click an empty part of the menu bar and pick it from Add a widget.

Where the projects come from​

The window looks for graphify projects each time it opens. It searches your watched folders and the folders you pointed it at. The same search runs in Settings › Connectors, on the graphify tile.

That tile lists every project found, with the date of its graph. A graph is behind when a commit in the folder is newer than the graph. Choose where the projects live adds a folder to search. Watch this folder links a project's source folder to a vault, so its code enters memory.

A project must sit under your home folder. Anything outside it is not read.

Reading the graph​

Pick a Project. Then start in one of two ways:

  • Central pieces shows the most connected nodes of the project.
  • The search field takes the Name of a function, class or file. Find lists the matches.

The view shows the starting node and its direct neighbours. Click a node and its own neighbours open. At most 80 nodes stay on screen. Past that limit the window counts the neighbours it did not place. Start again from one node to see them.

Fit to window frames what is on screen.

The legend reads three ways:

  • solid: read in the code
  • dashed: guessed by graphify
  • colour: graphify group

The graph is drawn by the same engine as the neural map.

Who breaks if it changes​

Click a function, a method or a class. The panel beside the graph answers from code.impact:

  • Callers in the graph, each with its file and line, and its level. Level 1 calls it directly.
  • Tests that name it (graphify does not see them).
  • Other packages that name it (outside the graph).
  • Documents that name it, which often hold the reason the code exists.

These last three come from a text search of the repository with git. A line found there is a word found, not a proven call. When nothing is found the panel says nothing found, and it gives no score.

A file, a dependency or a note found in the code has no call chain. The panel says so in a sentence and asks nothing.

A graph behind the code​

When a commit is newer than graph.json, the window says the graph is behind. Refresh it in the project with:

graphify update .

For your agents​

The same answer is open to agents as the code.impact action. It takes the project folder and a symbol, and climbs the call chain up to 6 levels. It can also read what memory holds about that symbol, from the vaults the agent was granted. It changes nothing and runs no model.