[P1] Project Tree-sitter CST into versioned Prolog syntax facts #96
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #93
Depends on: #94, #95
Goal
Turn a Tree-sitter parse tree into ordinary inspectable, versioned Prolog syntax observations tied to a Project file and parse generation.
Tree-sitter produces a concrete syntax tree. This issue owns the generic CST/syntax fact layer. It does not pretend that grammar node names already form a language-neutral semantic AST.
Parse generation model
Provide records equivalent in semantics to:
A new source version must produce a distinguishable parse generation. Old generations may remain inspectable but must not silently satisfy queries that request current observations.
Syntax fact model
Provide generic facts equivalent to:
Exact predicates may be optimized/refined. The semantic contract matters more than preserving these names.
Node identity must be stable within the parse generation and must not be a raw native pointer. If deterministic node identities across equivalent reparses are feasible, document the policy; do not promise cross-generation identity without proof.
Projection modes
Support at least two explicit modes if useful:
TSTreefor temporary analysis;Do not accidentally make materialization of every punctuation token mandatory for every workflow. Provide a way to materialize named nodes or selected node classes when that is the appropriate bounded representation.
Source text policy
Do not duplicate every node's full source text into the KB.
Store source spans and obtain bounded text by range when requested. Text extraction must validate that the requested node/span belongs to the corresponding file content generation.
Provide semantics equivalent to:
with a bounded/explicit source-generation lookup rather than trusting stale byte ranges against changed file contents.
Error and recovery observations
Represent Tree-sitter recovery information rather than failing the entire file whenever source is incomplete.
Preserve at least:
This is important for live agent edits where the file may be temporarily invalid.
Bounded indexing
The Project API must be able to apply explicit limits to projection/indexing, including where applicable:
Limit exhaustion must return a structured partial/blocked outcome; it must not silently claim a complete AST.
Provenance
Every materialized syntax fact must resolve back to:
The syntax layer is observational evidence, not trusted executable policy.
Acceptance criteria
Non-goals
Refs #93 #94 #95
Closed by PR #342 (rebase-merge).
Merge SHA:
156bfe9b2caffa1b967e77bee51263ee9e85fb50onmainExact-head gate evidence (recorded at PR comment): PlUnit 96 suites 1179/1179; deterministic 16/16; deep-experiment 15/15; paid deep-integration 6/6 at
z-ai/glm-5.3-flash; demo --json; git diff --check; research-approval 19/19; nix flake check all-pass (native 21/21 + FFI); all required CI green including the pinned paid OpenRouter lane.Successor slices: #97 (query/capture APIs — handoff posted), then #98, #99 under epic #93.