Repository navigation
context-forge: pin analysis branch + commit in artifacts, and use it to scope refresh - #18
Merged
Merged
Conversation
Record the git branch and commit hash the analysis ran against in the provenance header of every context-forge output, so a reader knows exactly which repo state the rules/findings reflect and refresh reruns from a known point. - context-constitution: capture branch + short SHA once at scan time (scan-protocol step 5, via the already-allowed `git rev-parse`), stamp it into the constitution and findings-log headers on write, and refresh that line to the current ref on merge/refresh (metadata, not a CF-4 overwrite). - context-scrubber: capture and stamp branch + short SHA into the scrubber-findings header at report time. - Update the three header templates with the new provenance placeholders. - Document the pinned-commit behavior in the plugin README; bump all three plugin manifests to 0.8.0 (byte-identical). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UemJKwSwi6rVj3tD5VEqGJ
Feed the analyzed commit now stored in each constitution's header into `refresh`'s diff floor, so reruns are scoped from the exact state last analyzed instead of a baseline a cosmetic edit could have shoved forward. - refresh-protocol: derive the floor as `git merge-base R_head R_write` — the older of the commit the file's header records (R_head) and the last commit that wrote the constitution (R_write). Resolve/verify R_head first and fall back to R_write when it is missing, `unknown`, or unresolvable (shallow clone, rebase, GC, force-push), keeping older constitutions and manual-edit-as-forge working unchanged. Staleness check remains the correctness net; the SHA only tightens the new-pattern hunt. - Rework the baseline guardrail to describe the augmenting merge-base floor (provenance in the artifact, never a side-channel state file). - Allow `Bash(git merge-base *)` in the skill; document the sharper baseline in the plugin README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UemJKwSwi6rVj3tD5VEqGJ
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 & why
Both context-forge skills previously stamped only an ISO date on the artifacts they generate, so a reader couldn't tell which repo state the rules/findings reflected. This PR records the git branch and commit hash the analysis ran against, and then puts that stored commit to work:
context-constitution refreshuses it to scope reruns to the diff from the exact state last analyzed.Changes
Store the provenance ref (constitution + scrubber)
context-constitutioncaptures branch (git rev-parse --abbrev-ref HEAD) + short commit (git rev-parse --short HEAD) once at scan time (scan-protocolstep 5), reused across every target in a monorepo, and stamps it into thecontext-constitution.mdandcontext-constitution-findings.mdheaders on write. Detached-HEAD and non-git cases degrade todetached HEAD/unknown.context-scrubbercaptures and stamps the same branch + commit into thecontext-scrubber-findings.mdheader at report time (audit-protocolstep 4).Use the stored SHA to sharpen
refresh's diff baselinerefresh-protocolnow derives the diff floor asgit merge-base R_head R_write— the older of the commit the file's header records (R_head) and the last commit that wrote the constitution (R_write). Resolving/verifyingR_headfirst and taking the older of the two means a purely cosmetic edit to the constitution can't shove the baseline past real code changes.R_headis missing,unknown, or unresolvable in the checkout (shallow clone, rebase, GC, force-push), it falls back toR_write— the prior behavior. Manual-edit-as-forge still holds; the staleness check remains the correctness net and the SHA only tightens the new-pattern hunt.Bash(git merge-base *)in the constitution skill (git rev-parse --verifywas already covered).Docs & versioning
0.7.0 → 0.8.0(byte-identical).Validation
validate_manifests.py(+--self-test) andplugins/context-forge/scripts/validate.py(+--self-test) all pass locally — the same commands CI runs.Notes
No behavioral change to the safety model: nothing new is written before a gate,
scan/checkmodes still write nothing, and noallowed-toolssurface beyond the addedgit merge-base(a read-only ancestry query).🤖 Generated with Claude Code
Generated by Claude Code