Turn the slice into a document, a diagram and two commands - #32
Merged
Conversation
Phase 2 of #23, which is where the feature becomes usable: `xaflogic walkthrough --from <seed>` and the `xaf_walkthrough` MCP tool. Both work offline, in either language, with no API key and no network. The diagram is emitted from the walk's own edge set -- node for node, arrow for arrow -- and nothing in the renderer decides what to draw. That is the point rather than an implementation detail: ask a model for a Mermaid diagram of a process and it will produce one, including edges that do not exist, drawn with a confidence indistinguishable from the true ones, in a format whose whole value is that a reader believes it at a glance. A test counts arrows against edges and boxes against nodes, because an invented arrow is precisely what a spot check of a diagram that looks right would miss. xaf_walkthrough is the first MCP tool that answers a question about a process. The other ten return atoms, so an agent asked how something works has to guess which atoms to fetch and then guess whether it has them all -- and the guess that stops one atom early produces a confident answer with a step missing. Three things reading the output caught that the tests would only have enshrined: - The opening sentence contradicted the section below it. A walk halted by a virtual call reported that it "ran out of code to follow", three lines above a heading listing the code it could not follow. A walk ends three ways, not two, and now says which. - Citations were written with backslashes, so every one of them would diff the day somebody regenerated the document on another machine. - A node that is only ever the source of a step was never cited at all -- the controller was named with nowhere to go and read it. Hence "What takes part", where every node gets its place exactly once. And one caught by running the command: writing the document through AnsiConsole wrapped it to the terminal width and broke the Mermaid block. It goes to stdout raw, so `walkthrough ... > process.md` gives the same file `--out` does. 373 tests, zero warnings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W45tzJFX3NoSrk7svtQeKT
Comment on lines
+42
to
+48
| foreach (var edge in slice.Edges) | ||
| { | ||
| // An edge can only be drawn between two nodes that are in the slice. The walk never | ||
| // records one that is not, and drawing a dangling arrow would invent a node. | ||
| if (ids.TryGetValue(edge.From, out var from) && ids.TryGetValue(edge.To, out var to)) | ||
| sb.AppendLine($" {from} -->|{Verb(edge.Kind, labels)}| {to}"); | ||
| } |
Comment on lines
+118
to
+125
| foreach (var edge in slice.Edges) | ||
| { | ||
| if (!byId.TryGetValue(edge.From, out var from) || !byId.TryGetValue(edge.To, out var to)) | ||
| continue; | ||
|
|
||
| // The citation is the target's, because the target is what the step introduces. | ||
| sb.AppendLine($"{++step}. **{from.Name}** {Verb(edge.Kind)} **{to.Name}** — {At(project, to)}"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of #23 — where the feature becomes usable.
xaflogic walkthrough --from <seed>and thexaf_walkthroughMCP tool. Offline, either language, no API key, no network.What comes out
Run against the fixture whose process goes through a virtual method:
The diagram is not drawn, it is emitted
Node for node, arrow for arrow, off the walk's own edge set. Nothing in the renderer decides what to draw.
That is the point rather than an implementation detail. Ask a language model for a Mermaid diagram of a process and it will produce one — including edges that do not exist, drawn with a confidence indistinguishable from the true ones, in a format whose entire value is that a reader believes it at a glance.
So the test counts:
Counted, not sampled — an invented arrow is exactly what a spot check of a diagram that looks right would miss.
Shapes carry meaning rather than decoration:
([action]),[[controller]],[(entity)],{{rule}}. A reader tells a stored thing from a command without a legend.xaf_walkthrough— the first tool about a processThe other ten MCP tools return atoms. An agent asked "how does approval work" has to guess which atoms to fetch, and then guess whether it has them all — and the guess that stops one atom early produces a confident answer with a step missing from it.
This one hands back the traced path and what it could not follow. An agent told "this call is virtual, here are the three overrides" can go read all three; an agent given silence cannot know to.
Four things reading the output caught
Written before the assertions, as usual.
AnsiConsolewrapped it to the terminal width and broke the Mermaid block across lines. It goes to stdout raw now, sowalkthrough … > process.mdgives the same file--outdoes.Translated, like everything else here
Twenty-nine new labels in both languages, including the diagram's edge verbs. A test asserts the Spanish page contains no English heading — a page half in one language is worse than either.
What is left
Phases 3 and 4:
--narrate(opt-in prose over a structure that is already fixed) and--since <ref>(what changed in this process). Both additive. Per the design, if the project stopped here it would already have gained the ability to explain a process, without a single new runtime dependency.373 tests, zero warnings.
🤖 Generated with Claude Code
https://claude.ai/code/session_01W45tzJFX3NoSrk7svtQeKT