Skip to content

Possible silent downgrade of semantic Markdown nodes during AST-only rebuild #2014

Closed

Description

@jose23677

Summary

After running /graphify . inside Claude Code (which dispatches semantic subagents for docs), a Markdown file's nodes in graphify-out/graph.json contain rich, LLM-extracted concepts/findings/decisions.

After a subsequent graphify update . (CLI) or a graphify hook install post-commit rebuild — neither of which has an LLM/subagent available — that same file's nodes are replaced with one generic node per Markdown heading. This happens silently: exit code 0, no warning printed, and the resulting graph is still structurally valid, so there's no signal in the output that content fidelity changed.

I'm not sure whether this is intended (i.e. the AST-only paths are documented as a lower-fidelity fallback and we're expected to always follow up with a full /graphify --update pass) or an oversight in how Markdown got included in the code-only rebuild path. Reporting either way since we only caught it by manually diffing node content, not from any warning or metric — happy to be told this is expected and the issue closed.

Before / after example

Before (`/graphify .` inside Claude Code, semantic subagent ran):
  ARQUITECTURA_COMPLETA.md
  → "V1 Stack Proposal (Next.js14 + n8n + Supabase + Claude 3.5 Sonnet + GPT-4o)"
  → "Anti-Hallucination Architecture Principle" (file_type: rationale)
  → "SaaS Pricing Model (Starter/Pro/Enterprise)"
  → ... (~12 concept/decision nodes)

After (`graphify update .` or the post-commit hook ran on this file):
  ARQUITECTURA_COMPLETA.md
  → "PUNTO 1: ARQUITECTURA Y STACK DEFINITIVO"
  → "1.1 Stack Tecnológico"
  → "1.2 Decisiones de Arquitectura Anti-Alucinación"
  → ... (one node per heading, file_type: "document")

Steps to reproduce

  1. In Claude Code, run /graphify . on a repo with a Markdown doc that has some named concepts/decisions in it (not just prose under headings). Confirm graphify-out/graph.json has semantic nodes for that file (entity names as labels, not heading text).
  2. From a plain shell (no Claude Code session), run graphify update ., or install and trigger the git hook (graphify hook install, then commit any change).
  3. Diff that file's nodes in graphify-out/graph.json before vs. after step 2.

Observed

  • The file's nodes change from semantic entities to one node per Markdown heading.
  • No warning, no error, exit code 0.
  • graphify-out/graph.json and GRAPH_REPORT.md both regenerate normally and remain structurally valid (no broken references, no crash).

Possible explanation (speculation — have not fully traced this, could be wrong)

Looking at the installed package (graphifyy 0.9.15), it appears _rebuild_code() in graphify/watch.py (used by both graphify update in cli.py and the git hooks in hooks.py) builds its file list from detected['files']['code'] plus any document file where _get_extractor(path) returns non-None (watch.py, around the # Include document files that have AST extractors comment). .md/.mdx/.qmd map to extract_markdown() (graphify/extractors/markdown.py), whose own docstring says it "Produces nodes for: The file itself, Each heading" — a deterministic structural extractor, analogous to AST for code. A later comment in watch.py ("AST-only rebuild replaces nodes for changed files; everything else is kept") suggests any file that goes through this path has its previous nodes evicted and replaced by this run's output — which for Markdown means the heading-only structural nodes, not the previously-run semantic ones.

If that reading is right, the underlying design (treating Markdown headings as a deterministic "structural skeleton" the same way AST is for code) makes sense — the part we weren't expecting is that this silently downgrades/overwrites prior semantic extraction for that file with no signal that it happened, since both code paths (graphify update and the hooks) are documented as safe, no-LLM-needed operations.

Is this the intended behavior for Markdown files in AST-only rebuilds?

What we're doing about it on our end

Not installing the git hooks. We route all graph updates through a small project-local wrapper that only allows graphify update . when every changed file is a code file (by extension, not by whether it has an extractor), and otherwise asks for /graphify --update inside Claude Code so semantic subagents run. Happy to share more detail if useful.

If this is intended behavior, I'd be happy to submit a documentation PR warning that semantic Markdown extraction is not preserved by AST-only rebuilds.

Environment

  • graphifyy 0.9.15 (PyPI), installed via uv tool install
  • macOS (arm64), Python 3.12

Activity

  1. safishamsi commented on Jul 20, 2026

    @safishamsi
    Member

    Fixed in v0.9.21: code-typed nodes the semantic pass surfaces from within a document now count as that doc's semantic layer, so an AST-only rebuild no longer re-scans and drops them. https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.21

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