Repository navigation
feat(archaeology): Code Archaeology Agent — reconstruct why decisions were made - #936
Merged
AmitoVrito merged 13 commits intoAug 22, 2026
Merged
Conversation
…erm-extraction helper Additive-only groundwork for follow-up fixes: EvolutionIndex.ensure_built() lets callers share one built index instead of each re-walking git history, and archaeology/_terms.py centralizes the query-term-extraction/matching snippet that was duplicated across timeline_reconstructor.py and evolution_diff.py. No existing behavior changes yet. Co-authored-by: Dhruv Garg <[email protected]>
EmailLoader stores the raw RFC 2822 "Date" header, but _email_events parsed it with datetime.fromisoformat(), which raises on every real email and silently substitutes datetime.now(UTC) — corrupting the chronological ordering CausalLinker relies on to infer cause vs. effect. Now parsed with email.utils.parsedate_to_datetime. Also switches _git_events/_slack_events/_email_events/_markdown_events to the shared extract_terms()/matches() helper (previously four near-identical, already-inconsistent copies of the same snippet), and lets the reconstructor accept a pre-built EvolutionIndex to avoid re-walking git history when one is already available. Co-authored-by: Dhruv Garg <[email protected]>
…history When no search term matched, trace() fell back to all_entries — the entire unfiltered commit history — instead of an empty result. ArchaeologyAgent.explain() calls trace(query) with the raw natural-language question (the common case), so any query whose terms don't literally match a file path/symbol/commit subject silently returned every commit in the repo into the narrative prompt. Also accepts a pre-built EvolutionIndex (shared with TimelineReconstructor via ArchaeologyAgent) to avoid a second full git-history walk per explain() call, and switches to the shared extract_terms() helper. Co-authored-by: Dhruv Garg <[email protected]>
… build ArchaeologyAgent.__init__ caught LLM construction errors with a bare `except Exception: self.llm = None` and no logging — a typo'd provider or missing API key silently degraded the agent to timeline-only mode with zero diagnostic trail. Now logs a warning with the traceback. Also builds one EvolutionIndex and passes it into both TimelineReconstructor and EvolutionDiff, so explain() walks git history (log/diff/AST-parse) once instead of twice — the two previously built entirely independent indexes. Co-authored-by: Dhruv Garg <[email protected]>
…n as best-effort _verify_claims awaited NeuroSymbolicAgent.solve() sequentially, one claim at a time — now runs via asyncio.gather so N claims cost one round-trip's latency instead of N. NeuroSymbolicAgent.solve() formalizes its input into an SMT/Prolog/MiniZinc/ Sympy constraint program and checks it with a solver — built for problems with decidable formal structure, not prose plausibility judgments. Free-text causal claims have no reliable formalization, so the resulting `verified` flag is a best-effort signal, not a formal proof. Documented that limitation on _verify_claims and logged it at call time so it isn't mistaken for a verified/formal guarantee. Co-authored-by: Dhruv Garg <[email protected]>
…n fakes Tests used unittest.mock (MagicMock/AsyncMock/patch) to stub SlackLoader, EmailLoader, and a NeuroSymbolicAgent-shaped verifier — mocks silently accept any call shape, so a real interface drift wouldn't be caught here. Replaced with a hand-written FakeLoader (monkeypatched onto .aload) and a FakeVerifier/FakeVerificationResult pair, matching this repo's no-mocking testing standard. Also strengthens regression coverage for the two correctness fixes in this series: asserts the exact parsed timestamp for an RFC 2822 email date, and asserts EvolutionDiff.trace() returns [] (not the full repo history) for both an unmatched file path and an unmatched natural-language query. Co-authored-by: Dhruv Garg <[email protected]>
Collaborator
|
Ran a multi-angle review (correctness, cleanup, altitude, testing conventions) and pushed 6 fix commits directly to this branch to address the confirmed findings:
Full suite (5070 tests) + archaeology suite (24 tests) pass, ruff clean. Great feature — thanks for building this, @DhruvGarg111! |
AmitoVrito
added a commit
that referenced
this pull request
Aug 22, 2026
#938) Co-authored-by: Dhruv Garg <[email protected]>
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.
Closes #744
Summary
Implements the Code Archaeology Agent (issue #744) that fuses git log, markdown notes, and (opt-in) Slack/email archives to reconstruct why code exists in its current form.
Components
Design
Testing