Skip to content

feat(rag): dedicated library vector tier and valkey symbol cache store - #83

Merged
dan-petty merged 6 commits into
release/v0.2.14from
feat/library-vector-tier
Sep 9, 2026
Merged

dan-petty merged 6 commits into
release/v0.2.14from
feat/library-vector-tier

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary of Changes

  • Dedicated Qdrant Collection (devops_libraries): Segregates third-party library API contracts, symbol signatures, and ingested doc chunks from workspace code vectors (devops_code) and general documentation (devops_docs).
  • L1 Fast In-Memory Valkey Symbol Cache: Implements sub-millisecond qualified symbol lookups (symbol:<qualname>) storing full JSON-serialized signatures (FunctionSignature, ClassSignature) with configurable 7-day TTL (DEFAULT_VALKEY_SYMBOL_TTL_SECONDS).
  • L2 Semantic & Exact Retrieval (LibraryVectorStore):
    • ensure_collection_exists(): Verifies and creates isolated devops_libraries collection in Qdrant with cosine metric.
    • index_contract(contract): Extracts functions, classes, methods, embeds signatures, upserts to Qdrant, and populates Valkey cache.
    • index_doc_chunks(chunks, package_name): Embeds and indexes doc chunks.
    • lookup_symbol(symbol, package): Checks Valkey L1 cache, with fallback to local JSON contract files (.data/libraries/*.json).
    • search(query, package, top_k): Dense vector semantic search returning typed LibrarySearchResult models.
  • CLI Ingestion Commands:
    • devops ai ingest index-libraries [--dir <path>] [--dry-run] [--format table|json]: Indexes local library contracts into Qdrant and Valkey.
    • devops ai ingest query-library <query> [--package <pkg>] [--exact] [--top-k <k>] [--format table|json]: Executes exact symbol lookup or semantic API search.
  • Agent Instructions & Routine Tasks Hardening:
    • Mandated automatic defect/incident tracking in GitHub Issues and GitHub Projects whenever encountering unexpected errors or warnings from devops CLI.
    • Added review of CLI command outputs, application logs, metrics, and OpenTelemetry tracing data to routine tasks matrix (Inner Loop Step 6 and Cadence B Step 4).

Issue Linkage

Closes #77

Quality & Invariant Verification

  • All 12 unit tests in tests/test_library_vector_tier.py pass cleanly.
  • Code complexity $\le 10$ and nesting depth $\le 5$ validated via devops scan complexity.
  • Strict typing verified with mypy --strict.
  • Code formatted with ruff format and linted with ruff check.
  • CLI documentation and README synchronized via devops docs generate --sync-readme.
  • All 10/10 primary CI quality gates passed cleanly via devops ci.

Copilot AI lite review requested due to automatic review settings September 9, 2026 17:46
@dan-petty dan-petty added this to the v0.2.14 milestone Sep 9, 2026
@dan-petty dan-petty added type/feature Type feature: a new function scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new CLI commands and vector store have verified runtime/behavior gaps (Qdrant collection creation API mismatch, missing method indexing, and commands not wiring Qdrant/embedder/Valkey for non-exact/real indexing paths).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Introduces a dedicated “library” RAG tier that separates third-party library API contracts and doc chunks from workspace code/docs vectors, adds a Valkey-backed symbol cache, and exposes new CLI ingestion/query commands to index and retrieve library symbols.

Changes:

  • Adds LibraryVectorStore to index/search a new Qdrant collection (devops_libraries) and optionally cache symbol signatures in Valkey.
  • Introduces devops ai ingest index-libraries and devops ai ingest query-library CLI commands plus help text and generated docs.
  • Hardens agent/routine-task guidance around mandatory defect filing and observability/log review.
File summaries
File Description
tests/test_library_vector_tier.py New unit/CLI tests covering the library vector tier behaviors and commands.
src/devops_cli/models/library.py Adds LibrarySearchResult model for typed search results.
src/devops_cli/lang/en/help.py Adds CLI help strings for the new ingest subcommands/options.
src/devops_cli/config/defaults.py Adds defaults for the libraries collection name and Valkey symbol TTL.
src/devops_cli/commands/ai_ingest.py Adds index-libraries / query-library commands and local contract loading/rendering helpers.
src/devops_cli/ai/rag/library_store.py Implements the LibraryVectorStore indexing, lookup, and semantic search logic.
src/devops_cli/ai/rag/init.py Exposes LibraryVectorStore from the devops_cli.ai.rag package.
src/devops_cli/ai/library/init.py Re-exports LibraryVectorStore from the devops_cli.ai.library package.
src/devops_cli/ai/knowledge_base/devops_cli/tasks/github_project_management.md Updates KB guidance with mandatory defect/incident tracking procedure.
docs/ROUTINE_TASKS.md Adds routine-task steps for telemetry/log/trace review and defect filing expectations.
docs/commands/ai.md Adds generated command docs for the new ingest subcommands.
docs/CLI_REFERENCE.md Adds generated CLI reference entries for the new ingest subcommands.
docs/agent/task.md Updates agent task tracking to include the new library vector tier work.
AGENTS.md Adds/expands mandatory defect filing and telemetry/log review guidance.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/devops_cli/ai/rag/library_store.py Resolved
Comment thread src/devops_cli/commands/ai_ingest.py Resolved
Comment thread src/devops_cli/commands/ai_ingest.py Resolved
Comment thread src/devops_cli/ai/rag/library_store.py Resolved
Comment thread src/devops_cli/commands/ai_ingest.py Resolved
@dan-petty
dan-petty merged commit 4674401 into release/v0.2.14 Sep 9, 2026
4 checks passed
@dan-petty
dan-petty deleted the feat/library-vector-tier branch September 9, 2026 19:36
@dan-petty dan-petty mentioned this pull request Sep 10, 2026
dan-petty added a commit that referenced this pull request Sep 10, 2026
* chore(release): initialize release/v0.2.14 branch and configure Dependabot

* fix(docs): scrub private configuration values, internal hostnames, and homelab references

* feat(ai): dynamic package introspection and multi-source docs ingestion engine (#82)

* feat(ai): add dynamic package introspection and multi-source docs ingestion engine

* fix(ai): enforce fully-qualified symbol index and dedicated error codes for library ingestion

* fix(ai): filter built-in descriptors from class method extraction

* feat(rag): dedicated library vector tier and valkey symbol cache store (#83)

* feat(rag): dedicated library vector tier, valkey symbol cache, and routine observability audit

* docs(roadmap): define v0.2.16 and v0.2.17 milestones for sandbox application lifecycle

* feat(gh): integrate github pages, issues, projects, and views with fastmcp and agent instructions

* docs(roadmap): enrich task context, technical specifications, and reprioritize milestones

* docs: compact v0.1 release documentation and codify automated compaction policy

* fix(rag): address code review feedback on library store and CLI client wiring

* feat(gh): enhance project sync with rest resolution, rate-limit guards, and issue reconciliation

* refactor(security): consolidate in-place security checks into canonical submodules

* feat(gh): add pr review threads management and project custom fields reconciler

* feat(ai): add ast prompt grounding and fastmcp library intelligence tools

- Filter out private submodules and __main__ in package introspection to eliminate CLI execution hazard (Fixes #84).
- Expose FastMCP library intelligence tools (ai_ingest_library, ai_query_library, ai_inspect_symbol) and resource://libraries/indexed dynamic resource (Closes #80).
- Implement import-driven AST prompt grounding and API contract injection in review pipeline (Closes #78).
- Add comprehensive contract, regression, and injection unit tests and sync roadmap.

* feat(ai): integrate tree-sitter multilingual ast engine and library drift auditor

Implement polyglot concrete syntax tree parsing, S-expression AST query
execution, and cross-file code graph synthesis for Python, TypeScript,
Go, Rust, Java, and HCL with zero-crash fallback parsers. Expose CLI
commands `devops ai ast parse` and `devops ai ast graph`, add
`--multilingual` support to `devops ai repomap`, and register FastMCP tools
`ai_ast_parse` and `ai_ast_graph`.

Implement workspace library API drift and deprecation usage auditor
`devops ai audit-library-usage` comparing AST call sites against indexed
library contracts to detect removed methods, unknown attributes,
unrecognized kwargs, and deprecated calls. Flatten nesting depth to satisfy
architectural invariant gates.

Closes #74
Closes #79

* feat(ai): integrate ai context packing and symbol-pruned prompt synthesizer

Implement `ContextPacker` in `src/devops_cli/ai/context_packer.py` to rank
imported symbols, strip unreferenced private methods/docstrings, and
skeletonize function/class bodies with ellipsis while preserving public
interfaces, parameters, defaults, and type annotations.

Expose CLI command `devops ai pack-context` and FastMCP tool `ai_pack_context`,
and integrate context packing into `_collect_linked_snippets` in the review
pipeline. Enforce strict cyclomatic complexity <= 10 and nesting depth <= 2.

Closes #85

* feat(rag): autonomous rag index drift detection and auto-reindexing engine

Closes #81

* chore(release): bump version to v0.2.14

* fix(docs): align jekyll configuration file naming to _config.yaml

* fix(review): remediate copilot findings and enhance project tracking instructions

- Harden security sanitizer with -p= and --token= sensitive argument prefixes
- Implement non-mutating thread-safe DNS resolution with fail-closed non-public IP validation
- Scope docs ingester chunk slugs to file relative paths, mask credentials in errors, and support multi-page crawling
- Fully qualify introspected function and class symbol signatures and filter private submodules
- Namespace Valkey cache keys and Qdrant vector point IDs with package qualification
- Integrate Tree-Sitter native CST parsing fallback and S-expression query filtering
- Disambiguate AST call graph edges against symbol bodies to prevent parameter shadowing
- Enforce valid Python AST pruning under context budgets without arbitrary string truncation
- Support module-level imports and alias attribute lookups in library drift auditor
- Forward multi-label filters in GitHub client and paginate review threads via GraphQL
- Align project custom field inference with declarative taxonomy label mappings
- Enhance agent instructions, routine tasks, and knowledge base for proactive project bootstrap and card tracking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/feature Type feature: a new function

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants