feat(ctx): phase-2 chain — one-hop reference + supersession neighborhood#445
Merged
Conversation
ctx chain <id> shows the records adjacent to a fact in one hop, so a reader follows related observations without grepping the substrate. Four edge kinds from a single scan: outbound (ctx ids the root's prose names, resolved or surfaced as '(referenced but not found)'), inbound (facts that name the root), supersedes, and superseded-by (a fork yields >1). One hop only, like gate chain — deeper walks are the reader re-invoking. The shared extractReferences (also behind gate chain) gains a third id kind: ctx-YYYY-MM-DD-NNN, returned in a new ctxIds field. This also fixes a latent mis-classification — the leading boundary allowed a hyphen, so a ctx-/i- id's digits could leak into requestIds; capturing the prefix keeps the three kinds disjoint. gate chain behavior is unchanged. Docs (verbs.md / AGENT.md / playbook.md / CLAUDE.md) and a changelog fragment updated. Full suite 1859/1859 green. Remaining phase-2: fork / status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The second phase-2
ctxverb (read-side):ctx chain <id>.Shows the records adjacent to a fact in one hop, so a reader can follow related observations without grepping the substrate — the ctx analogue of
gate chain.Edge kinds (all from a single substrate scan)
(referenced but not found)rather than dropped (records-outlive-writers). Self-references ignored.One hop only, like
gate chain: to go deeper, runctx chainon a surfaced id — the reader drives the depth. A missing root is a recoverable not-found; an isolated fact reports an empty neighborhood rather than an error.Shared scanner change (affects
gate chaintoo — behavior unchanged)extractReferences(the lexical id-scanner behindgate chainandUnrespondedConcernsQuery) gains a third id kind:ctx-YYYY-MM-DD-NNN, returned in a newctxIdsfield. This also fixes a latent mis-classification: the leading(?<!\w)boundary allowed a hyphen, so actx-…(ori-…) id's digits could leak intorequestIds. Capturing the prefix in the pattern keeps the three kinds disjoint.gate chaindoes not surface ctx ids, so its behavior is unchanged — covered by the existing chain regression tests plus new direct unit tests for the scanner.Verification
node tests/run.mjs, exit 0).chain.test.ts(7 e2e) +extractReferences.test.ts(6 unit, incl. the mis-classification regression guard).Remaining phase-2
fork/status.🤖 Generated with Claude Code