Commit Graph

5 Commits

Author SHA1 Message Date
rob 82aee9ef63 fix: recognize plain speaker lines in discussions 2025-11-01 14:22:14 -03:00
rob 4176f51e7d fix: Add YAML syntax fix and mock AI script for testing
- Fix missing space after colon in features.ai-rules.yml
- Add tools/mock_ai.sh for testing automation without real AI
- Ensures installer has valid YAML templates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 09:18:59 -03:00
rob 72577bd30d feat: Implement Phase 2 - AI-powered discussion automation
Complete implementation of the AI-enhanced automation system with 5 specialized agents:

## New Files

1. **automation/agents.py** (270 lines)
   - Agent 1: normalize_discussion() - Extracts structured info from natural language
   - Agent 2: track_questions() - Identifies questions and tracks answers (OPEN/PARTIAL/ANSWERED)
   - Agent 3: track_action_items() - Manages TODO → ASSIGNED → DONE lifecycle
   - Agent 4: track_decisions() - Logs ADR-style decisions with rationale
   - extract_mentions() - Parses @Name and @all mentions (no API required)
   - call_claude() - Anthropic API integration with JSON response parsing

2. **automation/summary.py** (289 lines)
   - update_marker_block() - Non-destructive marker block updates
   - format_votes_section() - Formats vote counts and participants
   - format_questions_section() - Formats open/partial/answered questions
   - format_action_items_section() - Formats TODO/ASSIGNED/DONE tasks
   - format_decisions_section() - Formats ADR-style decisions
   - format_awaiting_section() - Groups @mentions by target
   - update_summary_file() - Orchestrates all section updates

3. **docs/AUTOMATION.md** (361 lines)
   - Complete system documentation
   - Phase 1 (basic) and Phase 2 (AI) explanations
   - Conversation guidelines and markers
   - Configuration and troubleshooting

## Enhanced Files

**automation/workflow.py** (enhanced to 349 lines, +132 lines)
- get_discussion_changes() - Git diff extraction for incremental processing
- update_summary_votes() - Marker block update for votes (Phase 1 fallback)
- process_discussion_with_ai() - Orchestrates all AI agents
- Enhanced _run_status() - Processes with AI when available, graceful fallback
- Dual import style for different execution contexts (pre-commit hook vs direct)

## Features

### Phase 1 (Always Enabled):
-  Vote parsing and tracking (READY/CHANGES/REJECT)
-  Latest vote per participant logic
-  Summary file auto-update and staging
-  Non-blocking git hook integration

### Phase 2 (Optional, requires ANTHROPIC_API_KEY):
-  @Mention extraction and tracking
-  Question identification and status tracking
-  Action item lifecycle management
-  Decision logging with rationale (ADR-style)
-  Incremental processing via git diff
-  Graceful degradation when API unavailable

## Architecture

- Modular design with separate concerns (agents, summary, workflow)
- Non-blocking operation (always exits 0)
- Dual-phase capability (basic + AI-enhanced)
- Graceful fallbacks at every level
- Comprehensive error handling

## Testing

- All 11 existing tests passing
- End-to-end testing in /tmp/cdev-test-phase2a confirmed:
  - Vote tracking works correctly
  - @Mentions extracted and grouped by target
  - Summary files updated non-destructively
  - Auto-staging of updated summaries
  - Pre-commit hook integration functional

## Documentation

- AUTOMATION.md covers architecture, usage, and troubleshooting
- Code comments explain complex logic
- Example formats provided for all features
- Configuration and setup instructions included

This completes the Phase 2 automation milestone, providing a sophisticated
AI-powered discussion summarization system while maintaining full backward
compatibility with basic vote-only mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 18:12:48 -03:00
rob 858dcae72e fix: Make workflow.py executable and add missing argparse import
Critical bug fixes discovered during end-to-end testing:

1. Add missing argparse import to workflow.py
   - workflow.py was missing `import argparse`
   - Caused NameError when pre-commit hook tried to run it
   - Added import at line 13

2. Make workflow.py executable during installation
   - Installer now sets executable permissions (0o755)
   - Pre-commit hook checks `if [ -x "automation/workflow.py" ]`
   - Without executable bit, hook silently skipped workflow
   - Fix in setup_project.py lines 381-384

Testing:
- Created fresh project with installer
- Added votes to discussion file
- Verified workflow.py runs during commit
- Output: "CHANGES: 2 votes, READY: 3 votes" ✓

Impact:
- Users now see vote counts during commits
- Phase 1 orchestration fully functional
- Foundation ready for Stage 2 (summary updates)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 16:14:44 -03:00
rob 4e7ad11b4c feat: Implement vote parsing orchestrator and testing infrastructure
Major implementation milestone - core automation is now functional:

1. Add automation/workflow.py (Phase 1 - Vote Parsing)
   - Parse VOTE: lines from discussion files
   - Track latest vote per participant
   - Print human-readable vote summaries
   - Non-blocking (always exits 0)
   - Proper error handling for missing files/git failures
   - 158 lines of production-quality code

2. Add testing infrastructure
   - Create tests/ directory with pytest configuration
   - Add test_utils.py with actual version reading test
   - Add test_template_meta.py (stubs for META system tests)
   - Add test_build.py (stub for build verification)
   - Configure pytest in pyproject.toml (pythonpath)
   - All 4 tests passing

3. Add AGENTS.md - Developer guidelines
   - Project structure and module organization
   - Build, test, and development commands
   - Coding style and naming conventions
   - Testing guidelines
   - Commit and PR guidelines

4. Update docs/DESIGN.md
   - Document workflow.py implementation
   - Update automation status from "planned" to "implemented"
   - Clarify Phase 1 vs future phases

5. Code cleanup - Remove empty stub modules
   - Delete src/cascadingdev/feature_seed.py
   - Delete src/cascadingdev/fs_scaffold.py
   - Delete src/cascadingdev/ramble_integration.py
   - Delete src/cascadingdev/rules_seed.py

Impact:
- Users can now see vote counts in their commits
- Testing foundation enables safe refactoring
- Code is cleaner with only working modules
- Week 1 implementation goals complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 14:25:53 -03:00