-
Notifications
You must be signed in to change notification settings - Fork 28
feat: start 1.0.6 provenance and layered retrieval #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
026fa15
feat: add phase 1 provenance foundation
AVIDS2 985409e
feat: add phase 2 layered disclosure
AVIDS2 98642f0
feat: add phase 3 evidence retrieval
AVIDS2 0b8b9d7
fix: preserve legacy git provenance semantics
AVIDS2 f405e10
Merge origin/main into codex/1-0-6-phase1
AVIDS2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /** | ||
| * Disclosure Policy | ||
| * | ||
| * Lightweight helper that classifies an observation or index entry into | ||
| * an L1 / L2 / L3 disclosure layer based on its provenance fields. | ||
| * | ||
| * Rules (phase 2 first-cut): | ||
| * L2 — default working-context: explicit, undefined, or core-valued | ||
| * L1 — routing signal: hook auto-captures (non-core) | ||
| * L3 — evidence layer: git-ingest (non-core), or any other low-trust source | ||
| * | ||
| * git-ingest defaults to L3 but can be promoted to L2 by valueCategory=core. | ||
| * Rules are kept explicit and easy to extend in future phases. | ||
| */ | ||
|
|
||
| export type DisclosureLayer = 'L1' | 'L2' | 'L3'; | ||
|
|
||
| export interface ProvenanceFields { | ||
| sourceDetail?: string; | ||
| valueCategory?: string; | ||
| /** Legacy fallback: observations ingested before Phase 1 only have source='git'. */ | ||
| source?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Resolve the effective sourceDetail for an observation, supporting legacy | ||
| * observations that only have source='git' and no sourceDetail. | ||
| * | ||
| * This is the single fallback point — call this instead of reading sourceDetail | ||
| * directly whenever provenance classification or display is needed. | ||
| */ | ||
| export function resolveSourceDetail( | ||
| sourceDetail?: string, | ||
| source?: string, | ||
| ): 'explicit' | 'hook' | 'git-ingest' | undefined { | ||
| if (sourceDetail === 'explicit' || sourceDetail === 'hook' || sourceDetail === 'git-ingest') { | ||
| return sourceDetail; | ||
| } | ||
| // Legacy git memories: source='git' with no sourceDetail → treat as git-ingest. | ||
| if (source === 'git') return 'git-ingest'; | ||
| return undefined; | ||
| } | ||
|
|
||
| /** | ||
| * Classify a single observation or index entry into a disclosure layer. | ||
| */ | ||
| export function classifyLayer(fields: ProvenanceFields): DisclosureLayer { | ||
| const { valueCategory } = fields; | ||
| const sd = resolveSourceDetail(fields.sourceDetail, fields.source); | ||
|
|
||
| // Core-valued memories are always promoted to L2, regardless of source. | ||
| if (valueCategory === 'core') return 'L2'; | ||
|
|
||
| // Hook auto-captures without core classification → L1 routing signal. | ||
| if (sd === 'hook') return 'L1'; | ||
|
|
||
| // Git-ingest (including legacy source='git') defaults to L3. | ||
| if (sd === 'git-ingest') return 'L3'; | ||
|
|
||
| // Explicit, undefined/legacy, manual → L2 working context. | ||
| return 'L2'; | ||
| } | ||
|
|
||
| /** | ||
| * Return a compact source badge string for display in search tables. | ||
| * Accepts both sourceDetail and legacy source for fallback resolution. | ||
| * Keeps existing table structure stable — fits in a narrow column. | ||
| */ | ||
| export function sourceBadge(sourceDetail?: string, source?: string): string { | ||
| const sd = resolveSourceDetail(sourceDetail, source); | ||
| if (sd === 'explicit') return 'ex'; | ||
| if (sd === 'hook') return 'hk'; | ||
| if (sd === 'git-ingest') return 'git'; | ||
| return ''; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header comment says L3 includes “git-ingest (non-core), or any other low-trust source”, but
classifyLayer()currently routes any unknownsourceDetailto L2. Either update the comment to match the implementation (onlygit-ingest⇒ L3) or extend the logic to treat unknown/non-enumeratedsourceDetailvalues as L3 so future sources don’t get accidentally promoted into L2.