Skip to content

to_wiki() is exported and tested but never called from skill orchestration #354

Closed

Description

@johnp3004

Summary

graphify.wiki.to_wiki() is defined, re-exported via __init__.py, and unit-tested in tests/test_wiki.py. It generates the agent-crawlable wiki (index.md + one article per community + god-node articles) that is referenced in the README and CHANGELOG.

Despite this, no user-facing entry point in the package calls to_wiki(). The CLI (__main__.py) has no --wiki flag handling, and the skill orchestration (skills/graphify/skill.md, also bundled as graphify/skill.md) has no Step that calls it.

Evidence

Repo-wide code search for to_wiki:

$ gh api -X GET search/code -f q='to_wiki repo:safishamsi/graphify'
graphify/wiki.py        # definition
graphify/__init__.py    # re-export
tests/test_wiki.py      # unit test
CHANGELOG.md            # feature mention

Zero occurrences in __main__.py, skill.md, or any skill-*.md variant.

Observed inconsistency between v0.4.13 and main

  • v0.4.13 packaged skill.md line 29 documents --wiki as a valid skill argument:
    /graphify <path> --wiki    # build agent-crawlable wiki (index.md + one article per community)
    
    But there is no Step 6b/etc. in the same file that responds to --wiki by calling to_wiki(). The flag is silently accepted and ignored.
  • main HEAD (9c04b05) has removed even the documentation line, but the function definition and unit test remain. So on main, the function is exported and tested but completely undocumented in the skill.

Repro

pip install graphifyy==0.4.13
graphify install --platform claude
grep -i 'to_wiki' ~/.claude/skills/graphify/SKILL.md
# (no output)

The function itself works correctly when called directly — verified on a 189-node markdown corpus, generating 12 community articles + 10 god-node articles + index.md (~92 KB total) in well under a second.

Suggested fix

Add a Step 6b to skills/graphify/skill.md (and graphify/skill.md) parallel to the existing Step 6 obsidian block:

```markdown

Step 6b - Generate wiki (only if --wiki flag)

If `--wiki` was given:

` ` `bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.build import build_from_json
from graphify.wiki import to_wiki
from pathlib import Path

extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}

G = build_from_json(extraction)
communities = {int(k): v for k, v in analysis['communities'].items()}
cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
labels = {int(k): v for k, v in labels_raw.items()}

n = to_wiki(G, communities, 'graphify-out/wiki', community_labels=labels or None, cohesion=cohesion, god_nodes_data=analysis['gods'])
print(f'Wiki: {n} articles in graphify-out/wiki/')
"
` ` `
```

…and re-add the v0.4.13 documentation line on line 29 if removing it was unintentional.

Workaround for users who need the wiki today

Call to_wiki() directly via the public API, reconstructing communities from node['community'] attributes in graph.json and parsing community_labels out of GRAPH_REPORT.md's ### Community N - "label" headers. ~30 lines of Python, no LLM calls, no skill dependency.

Happy to send a PR if useful.

Activity

  1. johnp3004 commented on Apr 14, 2026

    @johnp3004
    Author

    Follow-up after inspecting both v0.4.13 (PyPI) and upstream main (9c04b05, pyproject.toml says v0.1.14):

    The gap exists in both version lines. These appear to be parallel lineages — v0.1.x is a near-total rewrite that slimmed __main__.py from 1,261 → 180 lines and removed update, cluster-only, query, path, explain, add, watch, and save-result from the CLI entirely.

    In v0.4.13: skill.md line 29 documents /graphify <path> --wiki but no Step calls to_wiki(). __main__.py has zero --wiki flag handling.

    In upstream main (v0.1.14): skill.md has removed even the documentation reference (zero wiki mentions in 1,204 lines). But to_wiki is still defined, still exported from __init__.py:21, still unit-tested in tests/test_wiki.py. And the CLAUDE.md template that graphify claude install writes still references graphify-out/wiki/index.md as an artifact users should consult (__main__.py:64 on main).

    The CHANGELOG on main claims --update regenerates wiki when graphify-out/wiki/ exists — but --update no longer exists as a CLI command in v0.1.x.

    Question: is to_wiki intended to be called via direct Python import by users, or is the flag→function wiring just missing across both lineages? If the former, a README note would help. If the latter, the original suggested fix still applies.

    Workaround for v0.4.13 users today (verified on a 189-node markdown corpus — 12 community articles + 10 god-node articles + index.md in <100ms, zero LLM calls):

    ```python
    import json, re
    from collections import defaultdict
    from networkx.readwrite import json_graph
    from graphify.cluster import score_all
    from graphify.analyze import god_nodes
    from graphify.wiki import to_wiki

    raw = json.loads(open('graphify-out/graph.json').read())
    G = json_graph.node_link_graph(raw, edges='links')
    communities = defaultdict(list)
    for nid, d in G.nodes(data=True):
    if d.get('community') is not None:
    communities[int(d['community'])].append(nid)
    communities = dict(communities)

    labels = {int(c): l for c, l in re.findall(
    r'^### Community (\d+) - "([^"]+)"',
    open('graphify-out/GRAPH_REPORT.md').read(),
    re.M
    )}

    n = to_wiki(
    G, communities, 'graphify-out/wiki',
    community_labels=labels,
    cohesion=score_all(G, communities),
    god_nodes_data=god_nodes(G),
    )
    print(f'wrote {n} articles')
    ```

  2. AveshLutchman commented on Apr 14, 2026

    @AveshLutchman

    I ran into this issue as well.
    The agent ended up duplicating the obsidian vault because I named the obsidian output obsidian-wiki lol.

  3. safishamsi commented on Apr 14, 2026

    @safishamsi
    Member

    Implemented in v0.4.14.

    pip install --upgrade graphifyy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions