Review

Review and apply proposed updates from cross-referencing

Installs: 0
Used in: 1 repos
Updated: 1d ago
$npx ai-builder add command russellgoldstein/review

Installs to .claude/commands/review.md

# Review Proposed Updates

Review, approve, and apply proposed updates generated by cross-referencing.

## Arguments

`$ARGUMENTS` - Options:
- (empty) - Interactive review of all pending proposals
- `update-NNN` - Review specific proposal by ID
- `--list` - List all pending proposals without reviewing
- `--apply-high` - Auto-apply all high-confidence proposals
- `--archive-rejected` - Move all rejected proposals to archive

## Task

### List Mode (`--list`)

Show all pending proposals:

```
Pending Proposals
=================

| ID | Target | Change Type | Confidence | Created |
|----|--------|-------------|------------|---------|
| update-001 | tasks/project.md | status | High | 2024-01-15 |
| update-002 | people/john.md | update | Medium | 2024-01-15 |
| update-003 | definitions/api.md | add | Low | 2024-01-15 |

Total: 3 pending proposals

Run /review to start reviewing, or /review update-001 to review specific proposal.
```

### Interactive Review (default)

For each pending proposal:

#### 1. Display Proposal

```
Proposal: update-001
====================
Target: knowledge/tasks/project-alpha-tasks.md
Type: Status change
Confidence: HIGH
Source: processed/2024-01-15-zoom-sprint-review.md

CURRENT CONTENT:
┌────────────────────────────────────
│ | Status | In Progress |
└────────────────────────────────────

PROPOSED CHANGE:
┌────────────────────────────────────
│ | Status | Done |
│ | Completed | 2024-01-15 |
└────────────────────────────────────

RATIONALE:
John Smith confirmed completion in sprint review.

SOURCE QUOTE:
> "The authentication work is done, we merged it yesterday."
```

#### 2. Ask for Decision

Present options:
- **Approve (a)** - Apply this change as-is
- **Modify (m)** - Edit the proposed content before applying
- **Reject (r)** - Do not apply, archive with rejection note
- **Defer (d)** - Skip for now, review later
- **Skip (s)** - Move to next without deciding

#### 3. Process Decision

**If Approved:**
1. Read the target file
2. Find the section to update
3. Apply the change using Edit tool
4. Update proposal status to "approved"
5. Add resolution metadata:
   ```yaml
   status: approved
   reviewed_date: YYYY-MM-DD
   applied: true
   ```
6. Move to `proposed-updates/archive/`
7. Log the action

**If Modified:**
1. Show current proposed content
2. Allow editing the proposed content
3. Apply the modified content
4. Update proposal with modification note
5. Move to archive

**If Rejected:**
1. Ask for rejection reason (optional)
2. Update proposal status to "rejected"
3. Add rejection metadata:
   ```yaml
   status: rejected
   reviewed_date: YYYY-MM-DD
   rejection_reason: "Reason provided"
   ```
4. Move to `proposed-updates/archive/`

**If Deferred:**
1. Update proposal with defer note
2. Keep in `proposed-updates/` for later review

### Auto-Apply High Confidence (`--apply-high`)

Automatically apply all high-confidence proposals:

```
Auto-Apply High Confidence Proposals
====================================

Found 2 high-confidence proposals:

1. update-001: Task status change
   Target: knowledge/tasks/project-alpha-tasks.md
   Applying... ✓ Applied

2. update-004: Project status update
   Target: knowledge/project-status/alpha-status.md
   Applying... ✓ Applied

Results:
- 2 proposals auto-applied
- 3 proposals remain (medium/low confidence)

Run /review to review remaining proposals.
```

### Specific Proposal Review (`update-NNN`)

Review just one proposal:

```
/review update-001
```

Shows that proposal and asks for decision, then returns.

## Apply Logic

When applying a change:

### For Status/Field Updates

```python
# Find the exact text to replace
old_text = proposal.current_content
new_text = proposal.proposed_content

# Use Edit tool to make the change
Edit(
    file_path=proposal.target_file,
    old_string=old_text,
    new_string=new_text
)
```

### For Adding Content

```python
# Find insertion point
anchor_text = proposal.insert_after  # or insert_before

# Read file, find anchor, insert new content
```

### For Merge Operations

1. Read both source files
2. Combine content intelligently
3. Write merged content to primary file
4. Delete or archive secondary file
5. Update any references

## Archive Structure

```
proposed-updates/
├── update-005.md          # Pending
├── update-006.md          # Pending
└── archive/
    ├── update-001.md      # Approved, applied
    ├── update-002.md      # Rejected
    ├── update-003.md      # Approved, applied
    └── update-004.md      # Approved, applied
```

## Logging

Append to `logs/review-YYYY-MM-DD.md`:

```markdown
## Review Log - <timestamp>

| Proposal | Decision | Target | Notes |
|----------|----------|--------|-------|
| update-001 | Approved | tasks/project.md | Applied successfully |
| update-002 | Rejected | people/john.md | Incorrect information |
| update-003 | Deferred | definitions/api.md | Need more context |
```

## Output

After review session:

```
Review Session Complete
=======================

Reviewed: 5 proposals

Results:
- 3 Approved and applied
- 1 Rejected
- 1 Deferred

Applied Changes:
- knowledge/tasks/project-alpha-tasks.md (update-001)
- knowledge/project-status/alpha-status.md (update-004)
- knowledge/people/john-smith.md (update-005)

Still Pending: 1 proposal
- update-003: Deferred for later review

Archived: 4 proposals moved to proposed-updates/archive/
```

## Safety Features

1. **Backup before apply**: Read original content before any edit
2. **Verify target exists**: Check file exists before attempting edit
3. **Confirm destructive actions**: Double-check before archive/merge operations
4. **Dry-run option**: Show what would change without applying
5. **Undo info**: Log enough detail to reverse changes if needed

## Error Handling

- **Target file not found**: Skip proposal, flag for review
- **Content mismatch**: Current content doesn't match expected - manual review needed
- **Edit fails**: Report error, keep proposal as pending
- **Archive fails**: Report error, proposal stays in main directory

Quick Install

$npx ai-builder add command russellgoldstein/review

Details

Type
command
Slug
russellgoldstein/review
Created
5d ago