Commit Graph
1031 Commits
Author SHA1 Message Date
KaifAhmad1 fcf0c684bd Fix method overriding bug: Rename conflicting _calculate_content_similarity method
- Renamed decision-specific method to _calculate_decision_content_similarity
- Preserves node-based _calculate_content_similarity for find_similar_nodes()
- Updates method call to use renamed method
- Fixes core node-similarity functionality that was broken
- Ensures both node similarity and decision similarity work correctly
- Prevents find_similar_nodes() from calling wrong method signature
- Maintains backward compatibility for all similarity features
2026-02-16 18:45:51 +05:30
KaifAhmad1 3589f3b807 Add comprehensive input validation to record_decision method
- Added validation for all required fields (category, scenario, reasoning, outcome)
- Added confidence range validation (0.0 to 1.0)
- Added type checking for all parameters
- Added length limits to prevent data corruption
- Added entity list validation with individual item checks
- Added metadata dictionary validation
- Added kwargs validation for additional fields
- Added input sanitization (trimming, type conversion)
- Ensures compliance with security-first input validation requirements
- Prevents malicious/corrupted data from affecting graph operations and analytics
2026-02-16 18:42:10 +05:30
KaifAhmad1 8e83d11479 Fix logging security issues: Replace raw exception exposure with structured logging
- Fixed agent_context.py: Use logger.exception() instead of raw exception in logs
- Fixed context_graph.py: Use logger.exception() for secure structured logging
- Fixed policy_engine.py: Replaced 10 instances of raw exception logging with structured logging
- Fixed decision_recorder.py: Replaced 8 instances of raw exception logging with structured logging
- Ensures compliance with secure logging practices (Rule 5: Generic Secure Logging Practices)
- Maintains detailed exception information in internal logs while protecting user-facing outputs
- Prevents potential sensitive data leakage through log messages
2026-02-16 18:39:03 +05:30
KaifAhmad1 79d554767d Fix security issues: Remove raw exception exposure in error messages
- Fixed trace_decision_causality() to return generic error message
- Fixed analyze_graph_with_kg() to return generic error message
- Fixed get_node_centrality() to return generic error message
- Maintains detailed logging internally while protecting user-facing outputs
- Ensures compliance with secure error handling requirements
2026-02-16 18:35:53 +05:30
KaifAhmad1 66e971d0f8 Resolve merge conflict and update context documentation
- Resolved merge conflict in test_context_graphs_examples.py
- Updated context documentation with user-friendly approach
- Enhanced README.md with strategic emojis for better visual appeal
- Improved context_usage.md with detailed, user-friendly examples
- Updated docs/reference/context.md with accessible language
2026-02-16 17:42:16 +05:30
KaifAhmad1 14f5e05336 Update context documentation with user-friendly approach and strategic emoji placement
- Enhanced README.md with strategic emojis for better visual appeal
- Updated context_usage.md with detailed, user-friendly examples
- Improved docs/reference/context.md with accessible language
- Added AgentContext sections with progressive learning approach
- Maintained professional appearance while improving readability
- Consistent documentation across all context module files
2026-02-16 17:40:50 +05:30
Mohd Kaif adddf82242 Merge pull request #317 from Hawksight-AI/KaifAhmad1-patch-1
Update CHANGELOG with Apache AGE security fixes
2026-02-15 16:28:36 +05:30
Mohd Kaif f2a042c796 Update CHANGELOG with Apache AGE security fixes
Added Apache AGE backend security fixes including SQL injection prevention and enhanced error handling.
2026-02-15 16:04:57 +05:30
Sameer Kadam 20755e69e2 feat(graph): add Apache AGE backend integration with configuration, registration, tests and documentation (#311) 2026-02-15 15:57:07 +05:30
Mohd Kaif b42bfaef09 Update CHANGELOG with fixes and enhancements (#316)
Documented fixes and enhancements related to Context Graphs and PolicyEngine, including comprehensive test coverage and improvements in decision handling.
2026-02-15 14:09:57 +05:30
Mohd Kaif 1e4798ca0d Update CHANGELOG with fixes and enhancements
Documented fixes and enhancements related to Context Graphs and PolicyEngine, including comprehensive test coverage and improvements in decision handling.
2026-02-15 13:48:28 +05:30
Mohd Kaif d2f8992ca9 Fix Context Graphs Decision Tracking & Add Comprehensive Tests (#315)
* context_fixes

* context_compliance_fixes

* Delete PR_CONTEXT.md

* Fix Context Graphs decision tracking and add comprehensive tests

- Fix empty/None decision ID handling in ContextGraph.add_decision()
- Fix None metadata handling to prevent TypeError
- Fix causal chain depth logic and node exclusion
- Fix nonexistent node handling in add_causal_relationship()
- Add missing properties field in to_dict serialization
- Add missing from_dict method for graph deserialization
- Fix precedent search direction in find_precedents()
- Fix UUID generation logic in all decision models
- Add comprehensive test suite with 9 tests covering all features
- Test coverage: decision tracking, graph analytics, use cases, performance
- All 71 context tests now passing (100% success rate)

Resolves critical bugs in Context Graphs feature (#290) implementation
2026-02-15 13:20:34 +05:30
KaifAhmad1 e51dd9d655 Merge branch 'context' of https://github.com/Hawksight-AI/semantica into context 2026-02-15 12:52:36 +05:30
KaifAhmad1 4e31296c1e Fix Context Graphs decision tracking and add comprehensive tests
- Fix empty/None decision ID handling in ContextGraph.add_decision()
- Fix None metadata handling to prevent TypeError
- Fix causal chain depth logic and node exclusion
- Fix nonexistent node handling in add_causal_relationship()
- Add missing properties field in to_dict serialization
- Add missing from_dict method for graph deserialization
- Fix precedent search direction in find_precedents()
- Fix UUID generation logic in all decision models
- Add comprehensive test suite with 9 tests covering all features
- Test coverage: decision tracking, graph analytics, use cases, performance
- All 71 context tests now passing (100% success rate)

Resolves critical bugs in Context Graphs feature (#290) implementation
2026-02-15 12:52:19 +05:30
Mohd Kaif 780f8adfbe Delete .all-contributorsrc (#314) 2026-02-14 22:32:43 +05:30
Mohd Kaif 8386d79543 Update CHANGELOG.md (#313) 2026-02-14 19:38:14 +05:30
Mohd Kaif 5d712d5a62 Context: PolicyEngine fixes, new context tests, cleanup — all tests passing (#312)
* context_fixes

* context_compliance_fixes

* Delete PR_CONTEXT.md
2026-02-14 18:25:24 +05:30
Mohd Kaif 47c0058dce Delete PR_CONTEXT.md 2026-02-14 18:04:37 +05:30
KaifAhmad1 b90ffcca9a context_compliance_fixes 2026-02-14 18:02:06 +05:30
KaifAhmad1 4cd3ef9aa8 context_fixes 2026-02-14 17:13:38 +05:30
Mohd Kaif 2df5edf30a Merge pull request #310 from Hawksight-AI/docs
docs: Add Context Engineering Enhancement to changelog
2026-02-13 19:22:36 +05:30
KaifAhmad1 0bc41fb39a docs: Add Context Engineering Enhancement to changelog
- Document PR #307 with comprehensive decision tracking system
- Include KG algorithm integration, PolicyException naming fix, and 9 bug fixes
- Note production-ready architecture with enterprise features
- Record 100% test coverage and comprehensive documentation
- Highlight backward compatibility and performance optimizations
2026-02-13 18:59:31 +05:30
Mohd Kaif 381224dcdc Merge pull request #309 from Hawksight-AI/docs
fix: Remove broken link to non-existent decision_tracking.md
2026-02-13 18:46:18 +05:30
KaifAhmad1 db64dce596 fix: Remove broken link to non-existent decision_tracking.md
- Remove broken link from reference/context.md that was causing CI failure
- Decision tracking functionality is now integrated into the context module
- Fix mkdocs build strict mode warning about missing target file
- Ensure documentation builds successfully in CI pipeline
2026-02-13 18:41:29 +05:30
Mohd Kaif b5aec8b832 Merge pull request #307 from Hawksight-AI/context-engineering
Context Engineering Enhancement: Decision Tracking, KG Algorithms & Context Graphs
2026-02-13 18:38:45 +05:30
KaifAhmad1 b36e09d282 docs: Update context_usage.md with enhanced features and PolicyException
- Add PolicyException to imports and examples
- Add comprehensive section on enhanced AgentContext with decision tracking and KG algorithms
- Add enhanced ContextGraph section with KG algorithm examples (centrality, community detection, embeddings)
- Add PolicyException management section with creation, storage, and retrieval examples
- Update table of contents to include new sections
- Include GraphStore requirement notes for decision tracking
- Add production-ready examples with all advanced features enabled
- Ensure documentation reflects all recent context engineering enhancements
2026-02-13 17:25:55 +05:30
KaifAhmad1 560661e66a fix: Rename Exception class to PolicyException to avoid naming conflict
- Rename Exception dataclass to PolicyException to avoid shadowing Python's built-in Exception
- Update all imports across decision tracking modules to use PolicyException
- Update type hints and method signatures to use PolicyException
- Update __init__.py exports to include PolicyException instead of Exception
- Update documentation examples to use PolicyException
- Ensure compliance with PR Compliance ID 2 for meaningful naming
- Prevent confusion between business model exceptions and Python exceptions
2026-02-13 17:18:55 +05:30
KaifAhmad1 ac51b74928 fix: Add GraphStore validation for decision tracking components
- Add explicit capability check for execute_query method before initializing decision tracking
- Prevent runtime failures when ContextGraph is used with decision tracking enabled
- Provide clear error message guiding users to use GraphStore or disable decision tracking
- Ensure compatibility between knowledge graph type and decision tracking requirements
- Validate GraphStore interface during AgentContext initialization
2026-02-13 17:06:27 +05:30
KaifAhmad1 7a24273f41 fix: Resolve centrality result misread in DecisionQuery
- Fix centrality access to properly read nested 'centrality' dictionary structure
- Update calculate_degree_centrality result access from centrality.get(decision_id) to centrality.get('centrality', {}).get(decision_id)
- Fix calculate_all_centrality result access to extract measures from nested wrapper structure
- Correct influence score calculation to use proper centrality measure keys
- Ensure centrality boosts and influence values are calculated correctly
2026-02-13 16:55:23 +05:30
KaifAhmad1 7a25a7791e fix: Resolve undefined Cypher path in multi_hop_reasoning
- Fix undefined path variable by properly binding path in MATCH clause
- Change MATCH (start)-[*1..{max_hops}]-(d:Decision) to MATCH path = (start)-[*1..{max_hops}]-(d:Decision)
- Ensure length(path) function works correctly in multi-hop reasoning queries
- Prevent runtime undefined variable errors in Cypher execution
- Maintain proper hop count calculation for decision relevance ranking
2026-02-13 16:30:12 +05:30
KaifAhmad1 17fc42ccaa fix: Resolve influence query placeholders in DecisionQuery
- Convert query strings to f-strings to properly substitute max_depth parameter
- Fix Cypher syntax for variable-length paths from *1..{max_depth} to *1..{max_depth}
- Remove max_depth from query parameters since it's now embedded in the query
- Ensure proper Neo4j/FalkorDB compatibility for influence analysis queries
- Prevent runtime query failures in analyze_decision_influence method
2026-02-13 16:23:18 +05:30
KaifAhmad1 62bf3bada9 fix: Resolve KG analytics API mismatch in ContextGraph
- Fix method name from calculate_all_centralities to calculate_all_centrality
- Update _to_kg_format() to return relationships key expected by CentralityCalculator
- Ensure proper graph format conversion for KG algorithms
- Fix centrality analysis in both analyze_graph_with_kg() and get_node_centrality()
- Prevent AttributeError and ensure correct analytics results
2026-02-13 16:17:37 +05:30
KaifAhmad1 e933c5ad69 fix: Enhance decision audit log with comprehensive context
- Fix audit logging to include actor, timestamp, outcome, and category
- Ensure compliance with PR Compliance ID 1 for comprehensive audit trails
- Add decision_maker, timestamp, and outcome to decision recording logs
- Enable proper reconstruction of who did what and when for auditing
- Maintain structured log format for easy parsing and analysis
2026-02-13 15:56:42 +05:30
KaifAhmad1 07d9193719 fix: Secure error handling in explainable_retrieval() method
- Fix security issue where raw exception messages were exposed to callers
- Replace str(e) with generic error message for user-facing responses
- Keep detailed error information in secure internal logs only
- Ensure compliance with PR Compliance ID 4 for secure error handling
- Prevent potential exposure of internal implementation details and sensitive backend errors
2026-02-13 15:44:51 +05:30
KaifAhmad1 c41cc28fff fix: Restore proper logging in _find_relevant_policies() exception handler
- Fix bug where exceptions were swallowed without logging in context_retriever.py
- Restore warning log for policy search failures with sanitized category
- Ensure compliance with PR Compliance ID 3 for robust error handling
- Prevent silent failures that hinder debugging and mask missing policy coverage
2026-02-13 15:25:16 +05:30
KaifAhmad1 7ad48df600 feat: Add comprehensive context engineering with decision tracking, KG algorithms, and context graphs
- Add decision tracking system with DecisionRecorder, DecisionQuery, CausalChainAnalyzer, PolicyEngine
- Implement KG algorithm integration with centrality, community detection, embeddings, path finding
- Add vector store integration with hybrid search and custom similarity weights
- Enhance context graphs with advanced analytics and decision support
- Update documentation with comprehensive context module reference
- Add production examples for banking and healthcare use cases
- Update README to highlight context graph framework capabilities
- Add comprehensive test suite for all new features
2026-02-12 23:04:29 +05:30
Mohd Kaif d766d0c287 Merge pull request #306 from Hawksight-AI/feature/pgvector-store
chore(changelog): Add pgvector store feature entry
2026-02-12 15:13:14 +05:30
KaifAhmad1 bb14ebcdda chore(changelog): Add pgvector store feature entry
- Document complete pgvector integration with all features
- Include security, performance, and CI/CD improvements
- Reference PR #303 and contributors @Sameer6305 and @KaifAhmad1
2026-02-12 14:45:40 +05:30
Mohd Kaif a77299b59b Merge pull request #305 from Hawksight-AI/feature/pgvector-store
fix(docs): Correct broken link in pgvector documentation
2026-02-12 14:39:27 +05:30
KaifAhmad1 bbbc2fb126 fix(docs): Correct broken link in pgvector documentation
- Fix relative link to vector_store_usage.md
- Resolve MkDocs strict mode warning
- Ensure docs build passes CI
2026-02-12 14:14:34 +05:30
Mohd Kaif 385a617f89 Merge pull request #303 from Sameer6305/feature/pgvector-store
Feature/pgvector store
2026-02-12 14:11:01 +05:30
KaifAhmad1 bb95c00a88 fix(benchmarks): Update vector storage test for backend store compatibility
- Fix test_vector_storage_manager_overhead to work with backend stores
- Handle both in-memory vectors and backend store vector_ids
- Ensure benchmark works with FAISS backend and other vector stores
2026-02-12 13:16:34 +05:30
KaifAhmad1 7c7a903a3b fix(vector_store): Handle different method names across backend stores
- Fix delegation logic for store_vectors() to handle add() vs add_vectors()
- Fix delegation logic for search_vectors() to handle search() vs search_similar()
- Add proper error handling for unsupported method names
- Resolve CI benchmark failure with FAISSStore integration
2026-02-12 12:55:21 +05:30
KaifAhmad1 64ce8497f4 resolve(vector_store): Merge conflict resolution for pgvector integration
- Keep pgvector backend integration with _init_backend_store method
- Preserve decision-specific components from main branch
- Maintain both VectorStore backend support and decision pipeline functionality
- Fix duplicate initialization and proper component placement
2026-02-12 12:31:26 +05:30
KaifAhmad1 7bb6a2291e feat(vector_store): Add pgvector backend integration to VectorStore class
- Add 'pgvector' to SUPPORTED_BACKENDS
- Implement _init_backend_store() method for backend-specific initialization
- Add delegation logic for store_vectors() and search_vectors() methods
- Provide proper error handling for missing connection_string
- Enable VectorStore(backend='pgvector') usage pattern

Resolves integration gap in PgVectorStore implementation
2026-02-12 12:23:46 +05:30
Mohd Kaif cc70238c4c Revise CHANGELOG for recent feature enhancements
Updated CHANGELOG with detailed enhancements and improvements in the KG module, security configuration, and resource allocation.
2026-02-11 22:51:56 +05:30
Mohd Kaif efabbdb538 Merge pull request #304 from Hawksight-AI/vector-store
[FEATURE] Enhanced Vector Store for Decision Tracking #293
2026-02-11 22:17:43 +05:30
KaifAhmad1 1ad09781a2 Remove PR description files 2026-02-11 21:47:36 +05:30
KaifAhmad1 3a59fb8da6 Fix code review issues: Security, reliability, and API compatibility
## Critical Fixes Applied

### 1. Sensitive Data Logging (Security)
- Sanitize scenario text in decision_context.py (truncate to 30 chars)
- Sanitize entity names in context_retriever.py (truncate to 20 chars)
- Sanitize category names in context_retriever.py (truncate to 20 chars)
- Replace raw exception details with exception type names
- Prevents PII/PHI leakage into application logs

### 2. Random Embedding Fallback (Reliability)
- Remove random embedding fallback in semantic embedding generation
- Remove random embedding fallback in structural embedding generation
- Replace with clear RuntimeError exceptions with actionable messages
- Prevents silent degradation and misleading similarity results

### 3. Filter Decisions kwargs TypeError (API Compatibility)
- Add **kwargs parameter to VectorStore.filter_decisions()
- Process kwargs ending with '_min'/'_max' as range filters
- Process other kwargs as exact match filters
- Maintains backward compatibility with existing API

### 4. Entities Filter Never Matches (Core Functionality)
- Fix list-to-list comparison in _filter_by_metadata()
- Handle both scalar and list metadata values correctly
- Use set intersection for list-to-list matching
- Fixes search_by_entities() and filter_decisions(entities=...)

## Testing Verification
- All critical fixes tested and verified working
- Sensitive data properly truncated in logs
- Embedding failures raise clear errors
- kwargs API works with loan_amount_min filters
- Entities filter correctly matches decisions
- Context retriever logging sanitized

## Impact
- Security: Prevents sensitive data exposure in logs
- Reliability: Clear error messages instead of silent failures
- Compatibility: Full backward API compatibility maintained
- Functionality: Core filtering features now work correctly
2026-02-11 21:46:31 +05:30
KaifAhmad1 852bf0596d Fix CI failure: Add gensim dependency for Node2Vec
- Add gensim>=4.3.0 to core dependencies
- Required for Node2Vec embeddings in enhanced vector store
- Fixes ImportError in benchmark tests
- Ensures Node2Vec functionality works out of the box
2026-02-11 20:54:16 +05:30