Skip to content
PifeatureBackend2 files · +1419 −125

Implement Go graph indexing worker (facts + vectors split) for graphrag-go

Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk

27msession
0interventions
GOAL

Port the Python ApeRAG graph worker's derive/sync design to the Go graphrag-go repo, then split it into separate facts and vectors workers matching the modality worker pattern.

  1. Prompt · +0
    All dependencies of the Python graph worker (aperag/indexing/graph.py) are done; implement the graph worker in the Go indexing/ package.
  2. Agent did · +0m
    Explored both repos: read the Python graph.py reference implementation and every relevant Go file (interface.go, graph.go, vector.go, summary.go, reconciler.go, lineage store, compactor, curation runner) to map the expected worker surface before writing code.
  3. Agent did · +7m
    Wrote a new indexing/graph_worker.go (~567 lines) implementing GraphModality with derive (chunks.jsonl -> kg.jsonl via extractor) and sync (lineage cleanup/rebuild, optional compaction/vector upsert), reusing existing store/vector contracts.
  4. Fail · +7m
    go test failed: graphstore.RelationWithLineage has no field or method Key, used in two places in the new worker.
  5. Agent did · +7m
    Fixed the relation key usage, added indexing/graph_worker_test.go (~407 lines) covering derive artifact writes and lineage sync, and got `go test ./indexing` and the broader graph package tests passing.
  6. Prompt · +19m
    还有 factsworker和vectorworker没实现 (facts worker and vector worker are still not implemented).
  7. Agent did · +19m
    Split the graph worker into GraphFactsWorker (writes facts/lineage only, clears descriptions) and GraphVectorsWorker (reuses the facts kg.jsonl artifact, only runs the vector phase), refactored shared lineage-phase helpers, added new tests, and reconfirmed `go test ./indexing ./graph/curation ./graph/store/...` passing.
  8. Outcome · +27m
    Rename cleanup verified (graph.go -> kg.go), full `go test ./...` passes across the repo; three worker types (GraphModality, GraphFactsWorker, GraphVectorsWorker) implemented and tested; session ends with the developer asking the agent to explain the original parse/index pipeline.
VERDICT

Next time I'd upfront ask for the facts/vector split explicitly instead of letting the agent build the monolithic GraphModality first and then retrofitting — that second prompt ('还有 factsworker和vectorworker没实现') is what actually forced the right architecture. Letting it explore both the Python reference and the existing Go store/vector contracts before writing any code paid off, since the compile error it hit (relation.Key) was a small, quickly-fixed mismatch rather than a design problem.

I tried this · 0

Discussion · 0

How Builds work