Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
406 changes: 0 additions & 406 deletions .claude/CLAUDE copy.md

This file was deleted.

8 changes: 4 additions & 4 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ result = storage.store_pattern(

## 📞 Project Contacts

**Security Questions:** security-team@company.com
**HIPAA Compliance:** hipaa-officer@company.com
**Code Review:** tech-lead@company.com
**General:** empathy-framework@company.com
**Security Questions:** admin@smartaimemory.com
**HIPAA Compliance:** admin@smartaimemory.com
**Code Review:** admin@smartaimemory.com
**General:** admin@smartaimemory.com

---

Expand Down
42 changes: 42 additions & 0 deletions .claude/rules/empathy/bug-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
paths: **/*.py, **/*.js, **/*.ts
---

# Bug Patterns (Auto-generated by Empathy)
Last sync: 2025-12-18 23:11

These patterns help identify and fix common bugs based on your team's history.

## Async Timing Bugs

### When you see: `Promise { <pending> } returned instead of resolved value`

### When you see: `UnhandledPromiseRejection: await undefined`

## Null Reference Bugs

### When you see: `TypeError: Cannot read property 'map' of undefined`

### When you see: `TypeError: Cannot read property 'map' of undefined`
**Root cause:** API returned null instead of empty array
**Fix:** Added default empty array fallback: data?.items ?? []

### When you see: `TypeError: Cannot read property 'map' of undefined`
**Root cause:** API returns undefined instead of empty array
**Fix:** Added optional chaining and default array fallback

### When you see: `TypeError: Cannot read property 'length' of undefined`

### When you see: `TypeError: Cannot read property 'length' of undefined`

## Unknown Bugs

### When you see: `ReferenceError: fetchUser is not defined`

## Type Mismatch Bugs

### When you see: `TypeError: expected str but got bytes`

## Import Error Bugs

### When you see: `ModuleNotFoundError: No module named 'pandas'`
39 changes: 39 additions & 0 deletions .claude/rules/empathy/coding-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
paths: **/*
---

# Coding Patterns (Auto-generated by Empathy)
Last sync: 2025-12-18 23:11

Coding patterns and quality findings from automated inspection.

## Debt

- # Use temporary directory for test logs

## General

- Historical import_error bugs suggest testing gaps
- Historical unknown bugs suggest testing gaps
- Historical import_error bugs suggest testing gaps
- Historical async_timing bugs suggest testing gaps
- Historical null_reference bugs suggest testing gaps

## Review

- Potential null/undefined reference
- Potential null/undefined reference (historical: bug_20250915_abc123)
- Potential null/undefined reference (historical: bug_20251212_97c0f72f)
- Potential null/undefined reference (historical: bug_null_001)
- Potential null/undefined reference (historical: bug_20251212_3c5b9951)
- Potential null/undefined reference (historical: bug_20251212_a9b6ec41)
- Potential null/undefined reference (historical: bug_20251212_a0871d53)
- Potential null/undefined reference (historical: bug_20250822_def456)

## Debugging

- Unresolved bug: null_reference

## Format

- File needs reformatting
12 changes: 12 additions & 0 deletions .claude/rules/empathy/security-decisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
paths: **/*.py, **/*.js, **/*.ts
---

# Security Decisions (Auto-generated by Empathy)
Last sync: 2025-12-18 23:11

Team security decisions and accepted risks. Reference these before flagging issues.

## Accepted Risks

- **unknown**:
8 changes: 8 additions & 0 deletions .claude/rules/empathy/tech-debt-hotspots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
paths: **/*
---

# Tech Debt Hotspots (Auto-generated by Empathy)
Last sync: 2025-12-18 23:11

Areas of the codebase with accumulated technical debt.
1 change: 1 addition & 0 deletions .github/preview-trigger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Trigger preview
87 changes: 87 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,93 @@ All notable changes to the Empathy Framework will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.10] - 2025-12-18

### Added

**Dev Wizards Web Backend**
- New FastAPI backend for wizards.smartaimemory.com deployment
- API endpoints for Memory-Enhanced Debugging, Security Analysis, Code Review, and Code Inspection
- Interactive dashboard UI with demo capabilities
- Railway deployment configuration (railway.toml, nixpacks.toml)

### Fixed
- PyPI documentation now reflects current README and features

---

## [2.2.9] - 2025-12-18

### Added

**Code Inspection Pipeline**
- **`empathy-inspect` CLI** - Unified code inspection command combining lint, security, tests, and tech debt analysis
- `empathy-inspect .` - Inspect current directory with default settings
- `empathy-inspect . --format sarif` - Output SARIF 2.1.0 for GitHub Actions/GitLab/Azure DevOps
- `empathy-inspect . --format html` - Generate visual dashboard report
- `empathy-inspect . --staged` - Inspect only git-staged changes
- `empathy-inspect . --fix` - Auto-fix safe issues (formatting, imports)

**SARIF 2.1.0 Output Format**
- Industry-standard static analysis format for CI/CD integration
- GitHub code scanning annotations on pull requests
- Compatible with GitLab, Azure DevOps, Bitbucket, and other SARIF-compliant platforms
- Proper severity mapping: critical/high → error, medium → warning, low/info → note

**HTML Dashboard Reports**
- Professional visual reports for stakeholders
- Color-coded health score gauge (green/yellow/red)
- Six category breakdown cards (Lint, Security, Tests, Tech Debt, Code Review, Debugging)
- Sortable findings table with severity and priority
- Prioritized recommendations section
- Export-ready for sprint reviews and security audits

**Baseline/Suppression System**
- **Inline suppressions** for surgical control:
- `# empathy:disable RULE reason="..."` - Suppress for current line
- `# empathy:disable-next-line RULE` - Suppress for next line
- `# empathy:disable-file RULE` - Suppress for entire file
- **JSON baseline file** (`.empathy-baseline.json`) for project-wide policies:
- Rule-level suppressions with reasons
- File-level suppressions for legacy code
- TTL-based expiring suppressions with `expires_at`
- **CLI commands**:
- `--no-baseline` - Show all findings (for audits)
- `--baseline-init` - Create empty baseline file
- `--baseline-cleanup` - Remove expired suppressions

**Language-Aware Code Review**
- Integration with CrossLanguagePatternLibrary for intelligent pattern matching
- Language-specific analysis for Python, JavaScript/TypeScript, Rust, Go, Java
- Cross-language insights: "This Python None check is like the JavaScript undefined bug you fixed"
- No false positives from applying wrong-language patterns

### Changed

**Five-Phase Pipeline Architecture**
1. **Static Analysis** (Parallel) - Lint, security, tech debt, test quality run simultaneously
2. **Dynamic Analysis** (Conditional) - Code review, debugging only if Phase 1 finds triggers
3. **Cross-Analysis** (Sequential) - Correlate findings across tools for priority boosting
4. **Learning** (Optional) - Extract patterns for future inspections
5. **Reporting** (Always) - Unified health score and recommendations

**VCS Flexibility**
- Optimized for GitHub but works with GitLab, Bitbucket, Azure DevOps, self-hosted Git
- Git-native pattern storage in `patterns/` directory
- SARIF output compatible with any CI/CD platform supporting the standard

### Fixed
- Marked 5 demo bug patterns from 2025-12-16 with `demo: true` field
- Type errors in baseline.py stats dictionary and suppression entry typing
- Type cast for suppressed count in reporting.py

### Documentation
- Updated [CLI_GUIDE.md](docs/CLI_GUIDE.md) with full `empathy-inspect` documentation
- Updated [README.md](README.md) with Code Inspection Pipeline section
- Created blog post draft: `drafts/blog-code-inspection-pipeline.md`

---

## [2.2.7] - 2025-12-15

### Fixed
Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ empathy-memory serve
- **Dual-layer architecture** — Redis for millisecond short-term ops, pattern storage for long-term knowledge
- **AI that learns across sessions** — Patterns discovered today inform decisions tomorrow
- **Cross-team knowledge sharing** — What one agent learns, all agents can use
- **Git-native storage** — Optimized for GitHub, works with any VCS (GitLab, Bitbucket, Azure DevOps, self-hosted)

### Enterprise-Ready
- **Your data stays local** — Nothing leaves your infrastructure
Expand Down Expand Up @@ -147,6 +148,48 @@ The API server runs at `http://localhost:8765` with endpoints for status, stats,

**VS Code Extension:** A visual panel for monitoring memory is available in `vscode-memory-panel/`.

## Code Inspection Pipeline (New in v2.2.9)

Unified code quality with cross-tool intelligence:

```bash
# Run inspection
empathy-inspect .

# Multiple output formats
empathy-inspect . --format json # For CI/CD
empathy-inspect . --format sarif # For GitHub Actions
empathy-inspect . --format html # Visual dashboard

# Filter targets
empathy-inspect . --staged # Only staged changes
empathy-inspect . --changed # Only modified files

# Auto-fix safe issues
empathy-inspect . --fix

# Suppress false positives
empathy-inspect . --baseline-init # Create baseline file
empathy-inspect . --no-baseline # Show all findings
```

**Pipeline phases:**
1. Static Analysis (parallel) — Lint, security, debt, test quality
2. Dynamic Analysis (conditional) — Code review, debugging
3. Cross-Analysis — Correlate findings across tools
4. Learning — Extract patterns for future use
5. Reporting — Unified health score

**GitHub Actions SARIF integration:**
```yaml
- run: empathy-inspect . --format sarif --output results.sarif
- uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
```

[Full documentation →](docs/CLI_GUIDE.md#code-inspection-pipeline-new-in-v229)

## License

**Fair Source License 0.9** - Free for students, educators, and teams ≤5 employees. Commercial license ($99/dev/year) for larger organizations. [Details →](LICENSE)
Expand Down
15 changes: 9 additions & 6 deletions agents/book_production/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@
Licensed under Fair Source 0.9
"""

from .base import AgentConfig, BaseAgent, MemDocsConfig, OpusAgent, RedisConfig, SonnetAgent
from .base import (
AgentConfig,
BaseAgent,
MemDocsConfig,
OpusAgent,
RedisConfig,
SonnetAgent,
)
from .editor_agent import EditorAgent
from .learning import (
# Pattern Extraction
from .learning import ( # Pattern Extraction; Feedback Loop; Quality Gap Detection; SBAR Handoffs
ExtractedPattern,
# Feedback Loop
FeedbackEntry,
FeedbackLoop,
# Quality Gap Detection
GapSeverity,
# SBAR Handoffs
HandoffType,
PatternExtractor,
QualityGap,
Expand Down
66 changes: 66 additions & 0 deletions agents/code_inspection/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""
Code Inspection Agent Pipeline

Multi-agent orchestrated code inspection with parallel execution,
cross-tool intelligence, and pattern learning.

Usage:
from agents.code_inspection import CodeInspectionAgent, run_inspection

# Simple usage
state = await run_inspection("./src")
print(f"Health Score: {state['overall_health_score']}/100")

# Advanced usage
agent = CodeInspectionAgent(
parallel_mode=True,
learning_enabled=True
)
state = await agent.inspect(
project_path="./src",
target_mode="staged"
)
print(agent.format_report(state))

Copyright 2025 Smart AI Memory, LLC
Licensed under Fair Source 0.9
"""

from .agent import CodeInspectionAgent, run_inspection
from .state import (
CodeInspectionState,
CrossToolInsight,
FindingSeverity,
HealthStatus,
HistoricalMatch,
InspectionFinding,
InspectionPhase,
ToolResult,
add_audit_entry,
calculate_health_score,
create_initial_state,
get_health_grade,
get_health_status,
)

__all__ = [
# Agent
"CodeInspectionAgent",
"run_inspection",
# State
"CodeInspectionState",
"create_initial_state",
# Types
"InspectionPhase",
"FindingSeverity",
"HealthStatus",
"InspectionFinding",
"ToolResult",
"CrossToolInsight",
"HistoricalMatch",
# Utilities
"calculate_health_score",
"get_health_status",
"get_health_grade",
"add_audit_entry",
]
25 changes: 25 additions & 0 deletions agents/code_inspection/adapters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Tool Adapters for Code Inspection Pipeline

Each adapter wraps an existing inspection tool and converts its output
to the unified ToolResult format for the pipeline.

Copyright 2025 Smart AI Memory, LLC
Licensed under Fair Source 0.9
"""

from .code_health_adapter import CodeHealthAdapter
from .code_review_adapter import CodeReviewAdapter
from .debugging_adapter import DebuggingAdapter
from .security_adapter import SecurityAdapter
from .tech_debt_adapter import TechDebtAdapter
from .test_quality_adapter import TestQualityAdapter

__all__ = [
"CodeHealthAdapter",
"CodeReviewAdapter",
"DebuggingAdapter",
"SecurityAdapter",
"TechDebtAdapter",
"TestQualityAdapter",
]
Loading
Loading