Skip to content

feat: add git-aware memory ingestion and validation - #151

Open
GautamSharma99 wants to merge 1 commit into
Autoloops:mainfrom
GautamSharma99:feat/git-aware-memory
Open

feat: add git-aware memory ingestion and validation#151
GautamSharma99 wants to merge 1 commit into
Autoloops:mainfrom
GautamSharma99:feat/git-aware-memory

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

Closes #147

Summary

This PR adds Git-aware memory workflows that bootstrap Greplica from repository history and detect claims whose code anchors become
stale after code changes.

What changed

Git history ingestion

Adds:

greplica git ingest
[--max-commits ]
[--max-age ]
[--prs]
[--github-token ]
[--dry-run]

The command:

  • Collects commit metadata and changed files using a single git log call.
  • Extracts claims from conventional commits and decision/requirement language.
  • Generates deterministic components from changed modules.
  • Detects recurring module co-changes and creates flows using statistical lift.
  • Creates a git_history source for every analyzed commit.
  • Optionally enriches sources with GitHub PR metadata.
  • Deduplicates generated objects against existing graph memory.
  • Supports previewing the generated proposal with --dry-run.

Continuous anchor validation

Adds:

greplica git watch
[--daemon]
[--once]
[--interval ]
[--anchor-threshold ]

The watcher:

  • Polls the repository HEAD for new commits.
  • Persists the last processed HEAD and full-audit timestamp.
  • Validates only claims touching changed files after a commit.
  • Periodically performs a complete anchor audit.
  • Reuses the existing tree-sitter resolver and stored anchor fingerprints.
  • Falls back to a full audit when a previous commit range cannot be resolved.
  • Avoids creating duplicate review relationships.

New graph vocabulary

Introduces:

  • insight claim kind for automatically extracted knowledge.
  • git_history source kind for commit provenance.
  • needs_review edge kind for claims with potentially stale anchors.

Review edges include a reason:

  • file_deleted
  • symbol_removed
  • file_content_changed

Proposal validation rejects new relationships that reference claims needing review. supersedes relationships remain allowed so stale
claims can be replaced.

Graph view

The graph view now:

  • Displays warning icons on claims needing review.
  • Adds a “Claims - Needs review” filter.
  • Distinguishes Git-history sources from session and code sources.
  • Includes insight claims in claim-type charts.

Testing

Added an end-to-end test that:

  • Creates a temporary Git repository with conventional commits.
  • Verifies claim, component, source, and co-change flow extraction.
  • Seeds a fingerprinted, code-verified claim.
  • Commits a behavioral change to its anchored file.
  • Confirms the watcher detects the changed file.
  • Confirms a needs_review edge is created with the correct reason.
  • Confirms proposals referencing the stale claim are rejected.
  • Confirms redundant checks at the same HEAD are skipped.

Graph-view tests were also expanded to cover Git-history sources, insight claims, warning indicators, and review filtering.

Validation

  • npm test
  • npm run typecheck
  • git diff --check

All checks pass against the latest main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Git-Aware Memory — Auto-Extraction from Git History & Stale Anchor Detection

1 participant