refactor: LLM-based concept extraction and two-pass hook protocol#30
Merged
anormang1992 merged 1 commit intomainfrom Mar 19, 2026
Merged
Conversation
…d two-pass hook protocol Demo: Refactor get_concepts into ConceptExtractor class with __call__, few-shot flag-to-concept examples, and error handling. Add --concepts-model CLI arg. Claude Code: Replace parse_bash_primitives with a two-pass protocol where Claude proposes concepts via a # vre: prefix, the hook extracts and grounds them, then returns updatedInput with the prefix stripped. Remove src/vre/builtins/ (SHELL_ALIASES, parse_bash_primitives) — no longer imported by anything in the package. Update README, docs/index.html, and tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
get_conceptsintoConceptExtractorclass — ChatOllama chain constructed once in__init__, reused across calls. Few-shot flag-to-concept examples in the prompt, negative constraint against returning flag names as primitives, and try/except with clear "is Ollama running?" error. Add--concepts-modelCLI arg.parse_bash_primitivesstatic mapping with a two-pass protocol — first call blocks and asks Claude to identify primitives, second call carries a# vre:concept1,concept2prefix that the hook extracts, grounds, and strips viaupdatedInputbefore execution. Claude proposes the concepts itself.src/vre/builtins/:SHELL_ALIASESandparse_bash_primitivesare no longer imported anywhere in the package. Dead code after the hook refactor.docs/index.htmllanding page, and project structure.Closes #26.
Test plan
TestParseVrePrefix— 5 new tests for prefix parsing edge casesTestRunHook— updated tests verify two-pass protocol (block without prefix, allow withupdatedInput, policy deferral withoutupdatedInput)# vre:prefix grounded and executed with prefix strippedexecuteprimitive not in graph → blocked;create + filewith insufficient depth → blocked with full trace🤖 Generated with Claude Code