Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
016c0e9
feat: Add automated code review system
May 29, 2026
794fa8c
improve: enhance error messages in virtos-cluster for better UX
May 29, 2026
928819a
docs: add security enhancements summary (Issue #116)
May 29, 2026
b8cd880
improve: enhance error messages in virtos-api for better UX
May 29, 2026
f27cb17
docs: Update CHANGELOG.md with today's work session entries
May 29, 2026
da7580b
docs: Add libvirt permission troubleshooting guide
May 29, 2026
dcbaffd
docs: clarify security documentation references in INDEX.md
May 29, 2026
530c5bf
feat: add audit logging to virtos-api
May 29, 2026
3760451
feat: add audit logging to virtos-secrets
May 29, 2026
5f719b0
test: add functional tests to virtos-common.bats
May 29, 2026
1af70bc
test: add functional tests to virtos-setup.bats
May 29, 2026
40cb62b
test: add functional tests to virtos-create-vm.bats
May 29, 2026
0b994d9
test: add functional tests to virtos-network.bats
May 29, 2026
793da0c
test: add functional tests to virtos-storage.bats
May 29, 2026
dd0e542
docs: update TESTING.md with functional test enhancements
May 29, 2026
b790a3f
feat: add comprehensive security verification tool (Issue #116)
May 29, 2026
d1b4433
ci: add code duplication detection to CI workflow
May 29, 2026
534179b
docs: add comprehensive Development Setup Guide to CONTRIBUTING.md
May 29, 2026
fe07c37
refactor: improve automated review script to reduce false positives
May 29, 2026
985e9ea
test: add 131 functional tests to virtos-backup.bats
May 29, 2026
4bd223d
test: add 103 functional tests for virtos-migrate
May 29, 2026
387ef1d
fix: improve security scan filters and fix permissions
May 29, 2026
098745f
test: add 106 functional tests for virtos-snapshot
May 29, 2026
221321d
docs: update SECURITY_ENHANCEMENTS_SUMMARY to reflect completed work
May 29, 2026
42220c1
improve: enhance automated-review.sh to reduce false positives
May 29, 2026
5ca7449
fix: correct TESTING_ROADMAP.md cross-references in COMMUNITY.md
May 29, 2026
21627be
docs: enhance help text for 5 advanced scripts with OPTIONS and EXIT …
May 29, 2026
7f3d931
fix: correct TESTING.md path in docs/INDEX.md
May 29, 2026
f147573
fix: correct TESTING_ROADMAP.md path in docs/V1_0_ROADMAP.md
May 29, 2026
4b7ee94
fix: correct BUILD_DEPENDENCIES.md paths in docs/BUILD.md
May 29, 2026
1323506
fix: correct RUNTIME_TESTING_PLAN.md path in docs/LIBVIRT-PERMISSIONS.md
May 29, 2026
a62f14e
fix: replace broken doc links in docs/DR-PROCEDURES.md
May 29, 2026
1a1d7c3
fix: replace broken documentation cross-references
May 29, 2026
e4573c7
docs: add missing cross-references for better navigation
May 29, 2026
d23941c
docs: clarify security hardening documentation in INDEX.md
May 29, 2026
f0c51b4
docs: add common VirtOS patterns section to CODING_STANDARDS.md
May 29, 2026
bb33a60
docs: add comprehensive Common Issues FAQ section to README
May 29, 2026
bc03252
style: auto-format Python files with black
May 29, 2026
bc0581a
style: auto-sort Python imports with isort
May 29, 2026
e1833a6
docs: add EXIT CODES section to 15 scripts (batch 1)
May 29, 2026
c144e39
feat: implement continuous multi-language code review system
May 29, 2026
1a86698
docs: add EXIT CODES section to 15 scripts (batch 2)
May 29, 2026
4ca5a4a
docs: add EXIT CODES section to 14 scripts (batch 3 - final)
May 29, 2026
d8b17a7
improve: enhance code review script to reduce false positives
May 29, 2026
acb53c9
docs: add container and cloud-init examples to QUICK-START.md
May 30, 2026
eb4a2f5
docs: add AI contribution guidelines to .claude/ directory
May 30, 2026
fb6c1af
docs: enhance VERSIONING.md with documentation consistency guide
May 30, 2026
d2dff76
fix: resolve code quality issues from multi-model review
Jun 1, 2026
f189e59
fix: resolve 759 shellcheck issues via multi-agent code review
Jun 1, 2026
67b4647
fix: remove eval and harden security in virtos-automation and other s…
Jun 1, 2026
e21bd58
fix: replace unsafe source with safe config parsing in virtos-quota
Jun 1, 2026
3522322
improve: enhance virtos-quota with proper header and help text
Jun 1, 2026
31beccf
fix: resolve P0 critical security vulnerabilities (#249, #250, #251)
Jun 1, 2026
3983b94
fix: secure credential storage in virtos-devops and virtos-secrets (#…
Jun 1, 2026
893d9fe
style: auto-format Python files with black (line length 79)
Jun 1, 2026
1b4496b
style: auto-format Python files with black
Jun 1, 2026
5a508a1
feat: add functional test suite to address false test confidence (#103)
Jun 1, 2026
1f8a546
docs: comprehensive progress report for 2026-06-01 session
Jun 1, 2026
e8060d3
fix: resolve shellcheck SC2030/SC2031 in virtos-keyring.sh
Jun 1, 2026
3b85af7
fix: resolve shellcheck warnings in test/example files
Jun 1, 2026
6d0cec5
fix: prevent virtos-web stop commands from exiting with error on stal…
Jun 1, 2026
908ea34
style: auto-format Python files with black
Jun 3, 2026
64d18e4
style: auto-sort Python imports with isort
Jun 3, 2026
318c00f
feat: add 4-model code review system with Gemini integration
Jun 3, 2026
0ab22d8
fix: improve code_review.sh security pattern matching
Jun 3, 2026
9570d2a
fix: use word boundaries in TODO/FIXME pattern matching
Jun 3, 2026
ef248b7
fix: resolve shellcheck quoting warnings in review scripts
Jun 3, 2026
c48e759
fix: replace hardcoded /tmp paths with secure temp files
Jun 3, 2026
f7e6f87
fix: eliminate FIFO TOCTOU race in virtos-cluster
Jun 3, 2026
07dc0a1
fix: replace source with parse_config_file in 4 scripts
Jun 3, 2026
077eb38
docs: add copyright headers and exit code documentation
Jun 3, 2026
cdc884e
feat: enhance multi-model workflow with complete rejection reasoning
Jun 3, 2026
be63854
fix: markdown linting issues in AI attribution docs
Jun 3, 2026
f1887cb
style: auto-format Python files with black
Jun 3, 2026
55a3bcf
feat: implement issue deduplication system
Jun 3, 2026
6f7215e
fix: add input validation and path safety checks
Jun 3, 2026
b6226f8
feat: add global AI workflows with multi-model consensus strategies
Jun 3, 2026
39171e9
feat: enhance pr-review with continuous auto-discovery mode
Jun 3, 2026
4748fbd
chore: remove scheduled code review task
Jun 3, 2026
33367b6
fix: auto-resolve 51 GitHub issues with multi-AI consensus
Jun 3, 2026
a3fb6c9
feat: enhance CI/CD workflows with comprehensive verification
Jun 4, 2026
20e6c5d
ci(deps): Bump softprops/action-gh-release from 2 to 3
dependabot[bot] Jun 4, 2026
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
312 changes: 312 additions & 0 deletions .claude/4-MODEL-SYSTEM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
# 4-Model Code Review System with Gemini

## Architecture

```
┌─────────────────────────────────────────────────────────────┐
│ ISSUE DETECTION │
│ (Shell, Python, Java scans via existing scripts) │
└────────────────────┬────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 4 WORKER AIs GENERATE FIXES │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ OPUS │ │ SONNET │ │ HAIKU │ │ GEMINI │ │
│ │ Fix A │ │ Fix B │ │ Fix C │ │ Fix D │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │
└────────────────────┬────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ 3 ARBITER AIs VOTE ON BEST FIX │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Opus Arbiter │ │Sonnet Arbiter│ │Gemini Arbiter│ │
│ │ Chooses: B │ │ Chooses: B │ │ Chooses: A │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ MAJORITY VOTE → Fix B (Sonnet) WINS │
└────────────────────┬────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ GITHUB ISSUE CREATED │
│ │
│ - Shows all 4 proposed fixes │
│ - Shows 3 arbiter opinions │
│ - Shows vote breakdown │
│ - Shows final selection with reasoning │
└─────────────────────────────────────────────────────────────┘
```

## Components

### 1. Worker AIs (4 models)

Each issue receives **4 independent fix proposals**:

- **Opus** (Claude): Highest capability, complex reasoning
- **Sonnet** (Claude): Balanced quality/speed
- **Haiku** (Claude): Fast, efficient
- **Gemini** (Google): Different training, different perspective

Each worker provides:

- Fix approach
- Complete code changes
- Rationale for approach
- Confidence level (0-100%)
- Potential risks

### 2. Arbiter Panel (3 models)

Three independent arbiters **vote** on best fix:

- **Opus Arbiter**: Evaluates all 4 fixes, selects best
- **Sonnet Arbiter**: Independent evaluation, selects best
- **Gemini Arbiter**: External perspective, selects best

**Decision Method**: Majority vote

- If 2+ arbiters agree → that fix wins
- If 3-way split → highest confidence fix wins
- Ties broken by confidence scores

### 3. Gemini Integration

**File**: `.claude/gemini_client.py`

Python client that calls Google Gemini API:

```python
call_gemini(prompt, schema=None)
```

**Environment Variable Required**:

```bash
export GEMINI_API_KEY="your-api-key"
```

**Model Used**: `gemini-1.5-pro-latest` (configurable via `GEMINI_MODEL`)

## GitHub Issue Format

Each issue shows complete transparency:

```markdown
## Issue
[Problem description]

## 4-Model Fix Proposals

### OPUS
- Approach: [description]
- Confidence: 85%

### SONNET
- Approach: [description]
- Confidence: 90%

### HAIKU
- Approach: [description]
- Confidence: 75%

### GEMINI
- Approach: [description]
- Confidence: 88%

## Multi-Model Arbiter Decision

**Final Selection**: SONNET

**Arbiter Vote Breakdown**:
- sonnet: 2 votes
- opus: 1 vote

### Arbiter Opinions:

**Opus Arbiter**: Selected sonnet
> Sonnet's approach is more robust and handles edge cases better

**Sonnet Arbiter**: Selected sonnet
> My own solution provides the best balance of safety and simplicity

**Gemini Arbiter**: Selected opus
> Opus solution is more comprehensive, though Sonnet's is safer

## ✅ ACCEPTED FIX: SONNET

**Code Changes**:
[Complete fix code]

**Rationale**: [Why this approach]
**Confidence**: 90%
**Risks**: [List of risks]

---
Models Used: Opus, Sonnet, Haiku, Gemini (4 workers)
Arbiters: Opus, Sonnet, Gemini (3 arbiters)
Decision Method: Majority vote
```

## Setup Requirements

### 1. Gemini API Key

```bash
# Add to your shell profile
export GEMINI_API_KEY="AIza..."

# Or add to .claude/settings.json env vars
```

### 2. Python Dependencies

```bash
pip install requests
```

### 3. Workflow File

**Location**: `VirtOS/.claude/workflows/multi-model-with-gemini.js`

## Usage

### Run 4-Model Review

```javascript
// Via Workflow tool
Workflow({
scriptPath: '/home/sfloess/Development/github/FlossWare/VirtOS/.claude/workflows/multi-model-with-gemini.js'
})
```

### Test Gemini Client

```bash
cd /home/sfloess/Development/github/FlossWare/VirtOS

# Simple prompt
python3 .claude/gemini_client.py "Rate this code quality 0-10"

# With JSON schema
python3 .claude/gemini_client.py \
"Find security issues" \
schema.json
```

## Benefits of 4-Model System

### Diversity

- **Claude models**: Different capability tiers
- **Gemini**: Different training data, architecture, perspective
- **Result**: More comprehensive coverage, fewer blind spots

### Robustness

- Single model bias eliminated
- Consensus-based decisions
- Multiple independent evaluations

### Transparency

- All proposals documented
- All arbiter opinions shown
- Vote breakdown visible
- User can verify decision quality

### Quality Control

- 3 arbiters provide checks and balances
- Majority vote prevents outlier selection
- Confidence scores influence ties

## Example Arbiter Scenarios

### Scenario 1: Clear Consensus

```
Opus Arbiter → selects Sonnet
Sonnet Arbiter → selects Sonnet
Gemini Arbiter → selects Sonnet
Result: SONNET (3/3 unanimous)
```

### Scenario 2: Split Decision

```
Opus Arbiter → selects Opus (90% confidence)
Sonnet Arbiter → selects Gemini (85% confidence)
Gemini Arbiter → selects Gemini (88% confidence)
Result: GEMINI (2/3 majority)
```

### Scenario 3: Three-Way Split

```
Opus Arbiter → selects Opus (92% confidence)
Sonnet Arbiter → selects Sonnet (88% confidence)
Gemini Arbiter → selects Gemini (85% confidence)
Result: OPUS (highest confidence wins tie)
```

## Cost Considerations

**Claude API**: Charged per token

- Opus: Most expensive, best quality
- Sonnet: Mid-tier pricing
- Haiku: Cheapest, fastest

**Gemini API**:

- Free tier: 60 requests/minute
- Paid tier: Variable pricing
- Generally cheaper than Claude Opus

**Budget Control**: Use workflow `budget` parameter to limit spending

## Continuous Review Integration

The 4-model system integrates with existing continuous review:

1. **Cron triggers** every 10 minutes
2. **Scans detect** issues (Shell, Python, Java)
3. **4 workers generate** fixes in parallel
4. **3 arbiters vote** on best fix
5. **GitHub issue created** with full transparency
6. **Auto-fix safe issues** (formatting, imports)
7. **Auto-commit and push** with co-author signature

## Monitoring

Check workflow progress:

```
/workflows
```

View logs:

```bash
tail -f /tmp/virtos-*.log
```

Check GitHub issues:

```bash
gh issue list --label "multi-model-review"
```

---

**Created**: 2026-06-03
**Status**: ✅ Active
**Worker AIs**: 4 (Opus, Sonnet, Haiku, Gemini)
**Arbiters**: 3 (Opus, Sonnet, Gemini)
**Decision Method**: Majority vote
Loading
Loading