Milestone knowledge capture: nomination inbox + binding prefilter - #39
Open
gmoon wants to merge 5 commits into
Open
Milestone knowledge capture: nomination inbox + binding prefilter#39gmoon wants to merge 5 commits into
gmoon wants to merge 5 commits into
Conversation
Captures the design conversation on hook-based knowledge capture as lattice nodes (design-first, before any code): - SRC-AGENT-MEMORY-HOOKS: Bratanic's unified agentic memory article/repo - THX-MILESTONE-NOMINATION: git milestones are higher-signal nomination points than session boundaries; capture should nominate, not auto-commit (extends THX-CONTEXT-INFRA) - REQ-CAPTURE-001..005: staging surface, binding-intersection prefilter, pre-commit nominator, pre-push gate, nominate-not-commit guardrail Implements REQ-CAPTURE-001 REQ-CAPTURE-002 REQ-CAPTURE-003 REQ-CAPTURE-004 REQ-CAPTURE-005 (as specifications; no code yet) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
Adds a nomination pipeline that surfaces lattice-worthy changes at git milestones without auto-writing the graph — the AI proposes, a human commits. - src/capture.rs: deterministic binding-intersection prefilter (changed files → implementations → satisfied requirements, no model call), plus a staging Inbox held outside .lattice/ (load/save/add/remove nominations) - lattice capture scan|add|list|show|accept|reject|gate|install-hooks wired in src/main.rs; accept materializes via existing add_requirement/ add_edge, the only path that mutates the graph (guardrail) - git pre-commit (non-blocking scan) and pre-push (health --check gate + nomination review) hook installer - 5 unit tests (prefilter hit/miss, inbox roundtrip + outside-.lattice guardrail, id allocation, kind→edge mapping) Recorded as IMP-CAPTURE-001..005; resolves REQ-CAPTURE-001..005; drift clean. Implements REQ-CAPTURE-001 REQ-CAPTURE-002 REQ-CAPTURE-003 REQ-CAPTURE-004 REQ-CAPTURE-005 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
Behavior-preserving cleanups from a 4-angle review of the capture code: - Altitude: move nomination→graph materialization (accept), the agent scan bundle, and git-hook script generation out of the main.rs CLI handler into src/capture.rs, where they are unit-testable and sit with the pipeline they describe. handle_capture is now thin arg-marshalling. - Efficiency: prefilter builds a single path→bindings index in one pass (was two passes + an id round-trip); accept loads/saves the inbox once (was a double read). - Simplification: single Inbox::position() backs both get() and remove_nomination(); hook scripts use plain strings (no \x20 escapes). - Consistency: capture reject routes errors through emit_error and gained --format, matching its sibling subcommands. Adds accept-guard and scan_bundle unit tests. 214 tests pass; clippy -D warnings clean; generated hooks validated with sh -n. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
Collapses the "spawn git, collect non-empty stdout lines" idiom that was duplicated in capture.rs (git_name_only) and the health command's code-impact block into one public helper in diff.rs, next to the other git helpers. capture's staged_files/changed_files_since and health's changed-file detection now both call diff::run_git_lines. Behavior-preserving; 214 tests pass, clippy -D warnings clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
Entity resolution for the capture pipeline, adapted from knowledge-graph- generation practice (dedup is a required post-processing stage there): at 'capture add' time, score the nomination's title+body against existing nodes by token-overlap (Jaccard) and attach likely-duplicate IDs. list/show surface them and add warns, so restatements of existing nodes reach the reviewer flagged instead of silently entering the inbox. Deterministic first pass; semantic dedup is a natural upgrade under the vector-search feature. - src/capture.rs: find_duplicates + token_set/jaccard; Nomination gains possible_duplicates; unit test for hit + non-match - src/main.rs: add handler computes/attaches duplicates and warns; list/show render them - lattice: REQ-CAPTURE-003-A (refines REQ-CAPTURE-003), IMP-CAPTURE-006, resolved verified; drift clean, health PASS Implements REQ-CAPTURE-003-A Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
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.
Summary
Adds a
lattice capturecommand group that surfaces lattice-worthy changes at git milestones (pre-commit, pre-push) without auto-writing the graph — the AI proposes typed nominations, a human accepts. This closes the "remember to remember" gap in lattice capture (today it relies on the agent choosing to runlattice add) while preserving curation discipline.Design was captured in the lattice first (a thesis + five
REQ-CAPTURErequirements), then implemented, per the repo's lattice-first workflow.What's New
src/capture.rs— the deterministic core:REQ-CAPTURE-002): intersects git-changed files with implementationbindpaths and resolves affected requirements viasatisfiesedges. No model call — the cheap gate that decides whether AI nomination is even worth invoking.REQ-CAPTURE-001,-005): nominations live inlattice-inbox.yamlat the repo root, deliberately outside.lattice/. The graph is mutated only by explicitaccept, which routes through the existingadd_requirement/add_edge— the nominate-not-commit guardrail.scan_bundle(agent contract),accept(materialization), andinstall_hooks(git hook generation), all unit-tested.src/main.rs):lattice capture scan | add | list | show | accept | reject | gate | install-hooks.scan; pre-pushhealth --checkhard gate + nomination review. Installer refuses to clobber unmanaged hooks without--force.What's Changed
diff::run_git_lineshelper;captureand thehealthcode-impact block now share one git-subprocess implementation (retires ~5 copies of the idiom).CLAUDE.md: documented the new command group.Lattice Impact
SRC-AGENT-MEMORY-HOOKS(Bratanic, Unified Agentic Memory Across Harnesses Using Hooks — the article that prompted this)THX-MILESTONE-NOMINATION(draft;extends THX-CONTEXT-INFRA)REQ-CAPTURE-001..005, all resolvedverifiedIMP-CAPTURE-001..005lattice drift: clean ·lattice health --strict --check: PASSTesting
.lattice/guardrail, id allocation, kind→edge mapping, accept guards, scan-bundle enrichment); 214 total tests passcargo fmt --checkclean;clippy --all-targets -D warningsclean.lattice/; generated hooks validated withsh -nNotes for reviewers
scanis intentionally agent-side; the Rust binary stays deterministic and never blocks a commit.--all-featuresbuild (pulls thevector-search/ONNX dep); I couldn't run that path in the sandbox (network-blocked binary download), so it's unverified locally. Default-featureclippy/tests are green.🤖 Generated with Claude Code
https://claude.ai/code/session_01PoEBdAc9emc4K3k3TfmX1T
Generated by Claude Code