[EPIC] Add first-class Project / SPEC / source-knowledge APIs #437
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#437
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?
Goal
Add the reusable Prolog-native foundation for representing a project, observing its source/code structure, defining a domain-neutral specification, freezing that specification, and verifying it against explicit evidence.
Planning and execution are optional consumers. A Project may be indexed without a SPEC. A SPEC may be created/frozen without a Project. VERIFY may evaluate a frozen SPEC against existing evidence without planning or execution.
Architectural boundary
This epic owns epistemic project/source/specification concepts, not trusted project policy or coding-agent UX.
It is distinct from:
Where #75 provides a canonical
ProjectIdentity, this API should be able to reference/reuse it rather than inventing a competing security-sensitive identity. Source-observation identity, parser generations, file hashes, and syntax-node identities remain separate epistemic/versioning concepts.Required Project model
Establish small normalized entities/relations equivalent in semantics to:
Do not encode all metadata into a single
file(Language, Path, ...)mega-term. Files, languages, parser backends, parse generations, symbols, and evidence need stable independent identities and relations.The model must support multiple projects, changed/moved files, unknown/ambiguous languages, generated/vendor/excluded metadata, embedded language regions, non-code artifacts, and versioned observations.
Parser/analyzer architecture
Use a pluggable source-analysis boundary.
Tree-sitter integration is a direct SWI-Prolog <-> Tree-sitter C API binding. Do not add Python, Node, Nim, or another runtime merely as glue.
Tree-sitter owns concrete/incremental polyglot syntax parsing. Prolog owns normalized facts, language adapters, semantics, inference, SPEC, and VERIFY.
For Prolog source, prefer SWI-native source/xref analysis for authoritative semantic facts where it is stronger than a generic Tree-sitter grammar.
Source observation model
The persistent/inspectable project KB must not depend on raw native pointer identity.
Provide normalized versioned observations equivalent to:
Preserve the distinction between low-level CST observations, normalized cross-language facts, richer language-specific facts, and derived Prolog relations/inferences. Do not flatten every language into one impoverished universal AST.
Provenance and freshness
Every material source-derived fact must be traceable to project, file, content hash/generation, parser backend/grammar identity, query/extractor identity where applicable, and source range.
A changed file must not leave old facts silently looking current. Stale observations may remain inspectable, but current queries and VERIFY need deterministic freshness semantics.
First-class SPEC contract
A SPEC is domain-neutral declarative data. Coding/project requirements are one useful specialization, not the definition of SPEC.
Required semantics:
Public API direction:
Exact naming/arity should follow repository conventions.
First-class VERIFY contract
VERIFY evaluates a frozen specification against observations/evidence and does not require PLAN or EXECUTE.
Outcomes should distinguish:
Verifier results preserve evidence/provenance and integrate with #56 without collapsing
proof existsintopremises are trustworthy. Worker/model self-report is not source evidence when a requirement asks for observable source/runtime state.Tree-sitter child issues
Dependency shape:
The SPEC and VERIFY contracts remain tracked by this epic and should be decomposed into focused implementation issues when their concrete API design is ready. Tree-sitter is an evidence source for them, not a mandatory dependency for domain-neutral SPEC use.
Security / authority invariants
consultarbitrary project Prolog as trusted executable policy.Integration acceptance
Non-goals
References
library(prolog_source)/library(prolog_xref)for native Prolog analysisDuplicate of #93 (pre-existing Forgejo mirror with GitHub number parity). Closing this accidental duplicate created by today's open-state sync; #93 stays canonical on Forgejo.