Project 01 · Knowledge and retrieval

Knowledge and retrieval, for people who have to defend what they wrote

PythonFastAPIPostgreSQLpgvectorNext.jsDocker

What it does

You bring a corpus - scripts, background documents, research notes - and it builds a knowledge layer beside it: assertions with the sentence they came from, summaries at whichever scale you are working at, and the disagreements between documents made visible instead of averaged away.

The graph is something you read and adjudicate in the product, not a query language you have to learn first. Facts, summaries, conflicts and merges sit on one page that opens from a mirror, so it still works when the inference service behind it is down.

What it can do

Facts that carry their own evidence

A fact is stored with the quote it came from plus character offsets into the document. That turns “which facts can no longer be located” into a filter instead of an audit across every row.

Five places a summary can live

A summary attaches to a chunk, a plot beat, a document, a project - and on the other axis, to an entity. Same table, same review flow, different scope.

Conflicts surfaced, verdicts recorded

Two documents that disagree become a conflict with a decision attached, instead of one of them silently winning because it ranked higher.

Review as part of the flow

Every summary is draft, approved, rejected or superseded, with who changed it and when. The inference service never sees that decision: review is the product’s own row.

Merges that survive a re-extraction

An alias is a decision, not an extraction result. Re-extracting a document deletes its knowledge units, and the decision you made about a name has to outlive that.

An ontology the project declares

A project states its own entity kinds and predicates, so a screenplay and a background document do not have to share a preset list. Declarations deactivate; they are never deleted.

Decisions I would defend

Two tables, and neither is a second authority. Facts and summaries are mirrored from the inference service; the only columns the product writes are the review ones. A mirror that starts inventing values is how one question ends up with two answers.

A stale fact stays readable. If the chunk a fact points at changes, the fact is marked stale rather than hidden. Hiding it would hide the fact that the knowledge moved - and in a document product, “this used to be true” is information, not noise.

The decision outlives the artefact. A re-extraction deletes knowledge units, which is correct - they are outputs. Anything a person decided about them is not an output, so it lives in its own row with its own lifecycle, and gets relinked by name and document when the artefacts come back.

The one number worth keeping from this build is five: the number of scopes a summary can live at. It is the decision that makes the rest simple - one table, one review flow, one place to look - and it is why the product can answer “summarise this scene” and “summarise this project” without two pipelines.

What I refused

A recall figure for a corpus I had not labelled. I could have produced a number from the embedding scores and it would have looked scientific. Without labelled queries the honest output is “unknown”, and the retrieval service exists because of that refusal.