Skip to content
Open
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
244 changes: 227 additions & 17 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
# Smart Assistant

AI-powered productivity assistant that lets you manage Jira tickets using natural language. Runs locally with Ollama — no cloud API needed.
AI-powered productivity assistant that lets you manage Jira tickets and Google Calendar meeting rooms using natural language. Runs locally with Ollama — no cloud LLM API needed.

## Features

| Feature | Description |
|---------|-------------|
| **Natural Language** | Talk to Jira like a human — "show my open issues", "move NPP-123 to Done" |
| **Natural Language** | Talk to Jira and Calendar like a human — "show my open issues", "book a room for tomorrow 2pm" |
| **8 Jira Tools** | Search, create, update, transition issues, add comments, list projects |
| **6 Calendar Tools** | Lookup members, list rooms, check availability (rooms + people), book/cancel rooms, list events |
| **Slack Bot** | Chat with the agent via DM or @mentions in channels |
| **Natural Language** | Talk to Jira like a human — "show my open issues", "weekly progress report" |
| **8 Jira Tools** | Search, create, update, transition issues, add comments, list projects |
| **Audio Transcription** | Local Whisper for automatic meeting transcription (100% free) |
| **Auto-Watch Drive** | Detect and process new Google Meet recordings automatically |
| **Streaming Responses** | Real-time token-by-token responses in both CLI and Slack |
| **Interactive Slack Bot** | Full-featured bot with buttons, modals, link unfurling, emoji reactions |
| **App Home Dashboard** | Personal Jira dashboard in Slack with open and recent issues |
| **Daily Digest** | Scheduled project updates posted to Slack channels |
| **Daily Digests** | Scheduled project updates (Jira) and meeting summaries (Meet) posted to Slack |
| **Local LLM** | Uses Ollama with Qwen 3 8B — your data stays on your machine |
| **Conversation Memory** | Remembers context within a session for follow-up questions |

## Installation

### Prerequisites

- Python 3.11+
- [Ollama](https://ollama.com/) running locally
- Jira account with API token
- Google Calendar backend (one of):
- **Apps Script web app** (recommended) — easy setup, works with personal Workspace accounts
- Service Account with Domain-Wide Delegation (legacy)
- Docker with GPU support
- Jira API token
- Docker with GPU support (or local Ollama installation)
- FFmpeg (for audio transcription)
- Jira API token (optional)
- Google Cloud service account with Meet API access (optional)

### Setup

Expand All @@ -36,15 +52,21 @@ ollama pull qwen3:8b
ollama list
exit

# 3. Install Smart Assistant
# 3. Install FFmpeg (required for audio transcription)
# Ubuntu/Debian
sudo apt install ffmpeg
# macOS
# brew install ffmpeg

# 4. Install Smart Assistant
git clone <repo-url> && cd smart_assistant
uv venv && source .venv/bin/activate
uv sync
uv pip install -e .

# 4. Configure credentials (create .env file, see below)
# 5. Configure credentials (create .env file, see below)

# 5. Verify and start
# 6. Verify and start
sa status
sa agent
```
Expand All @@ -54,6 +76,10 @@ sa agent
If you have Ollama installed locally:

```bash
# Install FFmpeg
sudo apt install ffmpeg # Ubuntu/Debian
# brew install ffmpeg # macOS

ollama pull qwen3:8b
git clone <repo-url> && cd smart_assistant
uv venv && source .venv/bin/activate
Expand Down Expand Up @@ -82,6 +108,15 @@ JIRA_BASE_URL=https://your-company.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your-api-token

# Google Calendar Configuration
# Option A: Apps Script web app (recommended)
CALENDAR_APPS_SCRIPT_URL=https://script.google.com/macros/s/.../exec

# Option B: Service Account (legacy, requires Domain-Wide Delegation)
# CALENDAR_SERVICE_ACCOUNT_FILE=/path/to/service-account.json
# CALENDAR_IMPERSONATE_EMAIL=admin@company.com
# CALENDAR_CUSTOMER_ID=my_customer

# Slack Configuration (optional)
# Create app at: https://api.slack.com/apps
# Enable Socket Mode and get tokens
Expand All @@ -93,8 +128,38 @@ SLACK_DIGEST_CHANNEL=C1234567890
SLACK_DIGEST_TIME=09:00
SLACK_DIGEST_PROJECT=PROJ
SLACK_DIGEST_DAYS=1

# Whisper Configuration (optional - for audio transcription)
WHISPER_MODEL_NAME=base # tiny/base/small/medium/large-v3/large-v3-turbo
WHISPER_LANGUAGE= # Empty for auto-detect, or ko/en/ja...
WHISPER_DEVICE=auto # auto/cuda/cpu

# Google Drive Watcher (optional - for auto-detection of Meet recordings)
GOOGLE_DRIVE_ENABLED=false
GOOGLE_DRIVE_CREDENTIALS_FILE=credentials.json
GOOGLE_DRIVE_TOKEN_FILE=token.json
GOOGLE_DRIVE_RECORDINGS_FOLDER=Meet Recordings
GOOGLE_DRIVE_NOTIFICATION_CHANNEL=C1234567890
GOOGLE_DRIVE_POLL_INTERVAL=30
```

### Calendar Backend

When `CALENDAR_APPS_SCRIPT_URL` is set, the Apps Script backend is used. Otherwise, it falls back to the Service Account backend. `sa status` shows which backend is active:

```
✓ Google Calendar [Apps Script] (11 rooms)
✓ Google Calendar [Service Account] (11 rooms)
```

#### Apps Script Setup (Recommended)

1. Go to https://script.google.com with your Workspace account
2. Create a new project and paste the Apps Script code (see `docs/`)
3. Add services: **Google Calendar API** (`Calendar`), **Admin SDK API** (`AdminDirectory`), **People API** (`People`)
4. Deploy as web app: Execute as **me**, Access **anyone**
5. Set the deployment URL in `.env` as `CALENDAR_APPS_SCRIPT_URL`

### Slack App Setup

Configure your Slack app at https://api.slack.com/apps:
Expand All @@ -110,9 +175,11 @@ Configure your Slack app at https://api.slack.com/apps:

| Command | Description |
|---------|-------------|
| `sa status` | Check Ollama + Jira connection |
| `sa status` | Check Ollama, Jira, and Google Calendar connection |
| `sa agent` | Start interactive AI agent with streaming |
| `sa slack` | Start Slack bot with all features |
| `sa meet-watch` | Watch Google Drive for new recordings (auto-transcribe) |
| `sa meet-upload <file>` | Manually transcribe and summarize audio file |
| `sa models` | List available Ollama models |
| `sa pull <model>` | Pull a model from Ollama |

Expand All @@ -123,7 +190,7 @@ Configure your Slack app at https://api.slack.com/apps:
- **Link Unfurling**: Auto-expand Jira URLs with issue details
- **App Home Dashboard**: Personal view of open and recent issues
- **Emoji Shortcuts**: React with ✅👀💬 for quick actions
- **Daily Digest**: Scheduled project updates to channels
- **Daily Digests**: Scheduled Jira project updates and Meet summaries to channels

## Usage

Expand All @@ -132,17 +199,41 @@ Configure your Slack app at https://api.slack.com/apps:
sa agent
You: show my open issues
You: create a task in NPP called "Fix login bug"
You: recent meetings
You: summarize meeting spaces/abc/conferenceRecords/xyz
You: reset

# Slack
@bot show my open issues
@bot weekly progress for NPP36, assignee Tairen Piao

# Emoji shortcuts
# Emoji shortcuts (Jira only)
React with ✅ → Mark as Done
React with 👀 → Assign to me
React with 💬 → Add comment

# Meeting Transcription (100% free)
sa meet-watch # Start watching for new recordings
sa meet-upload recording.mp3 # Manual transcription
sa meet-upload zoom_call.wav --transcript-only
```

### Google Calendar

```
You: List meeting rooms
You: Show rooms in HQ with capacity over 6
You: Find available rooms tomorrow 2-3pm
You: Book a room for "Sprint Review" tomorrow 2-3pm with Tairen Piao
You: Show my calendar today
You: Cancel event evt001
```

The agent automatically chains multiple tools for complex requests. For example, "Book a room with Tairen Piao tomorrow at 2pm" triggers:

1. `calendar_lookup_member` (resolve name) → find `tairen.piao@nota.ai`
2. `calendar_check_availability` (check rooms + attendees) → find rooms where both are free
3. `calendar_book_room` (create event) → confirm booking with attendee

## Jira Tools

Expand All @@ -157,15 +248,134 @@ React with 💬 → Add comment
| `jira_add_comment` | Add comment to issue |
| `jira_list_projects` | List all projects |

## Calendar Tools

| Tool | Description |
|------|-------------|
| `calendar_lookup_member` | Look up a Workspace member by name to find their email |
| `calendar_list_rooms` | List meeting rooms (optional: filter by building, min capacity) |
| `calendar_check_availability` | Check room and attendee availability for a time range |
| `calendar_book_room` | Book a room by creating a calendar event with attendees |
| `calendar_cancel_booking` | Cancel a booking by event ID |
| `calendar_list_events` | List upcoming events (optional: time range, calendar ID) |

## Architecture

```
smart_assistant/
├── cli.py # Typer CLI commands with rich UI and streaming
├── agent.py # AI agent with streaming responses and tool calling
├── jira_mcp.py # Jira integration (8 tools via mcp-atlassian)
├── slack_bot.py # Slack bot with 6 interactive features
├── slack_blocks.py # Slack Block Kit UI builders
├── ollama_service.py# Ollama client wrapper
└── config.py # Pydantic settings management
```
├── cli.py # Typer CLI commands with rich UI and streaming
├── agent.py # AI agent with streaming responses and tool calling
├── jira_mcp.py # Jira integration (8 tools via mcp-atlassian)
├── whisper_service.py# Local Whisper transcription (faster-whisper)
├── drive_watcher.py # Google Drive auto-detection for recordings
├── slack_bot.py # Slack bot with interactive features
├── slack_blocks.py # Slack Block Kit UI builders
├── ollama_service.py # Ollama client wrapper
└── config.py # Pydantic settings management
```

## Meeting Transcription Setup (100% Free)

Automatically detect and transcribe Google Meet recordings saved to Google Drive using local Whisper. **Completely free, no Google Workspace subscription required.**

### Requirements

- Google account with Meet recording capability (free with Google One 2TB+ or Workspace)
- FFmpeg installed (for audio processing)
- Disk space for temporary audio files

### 1. Create OAuth Credentials

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project (or use existing)
3. Navigate to **APIs & Services** → **Library**
4. Search for **Google Drive API** and enable it
5. Go to **APIs & Services** → **Credentials**
6. Click **Create Credentials** → **OAuth client ID**
7. Application type: **Desktop app**
8. Download the JSON as `credentials.json` in project root

### 2. Configure .env

```bash
# Whisper Configuration
WHISPER_MODEL_NAME=base # or large-v3-turbo for better accuracy
WHISPER_LANGUAGE= # Empty for auto-detect (or ko/en/ja...)
WHISPER_DEVICE=auto # auto/cuda/cpu

# Google Drive Watcher
GOOGLE_DRIVE_ENABLED=true
GOOGLE_DRIVE_CREDENTIALS_FILE=credentials.json
GOOGLE_DRIVE_TOKEN_FILE=token.json
GOOGLE_DRIVE_RECORDINGS_FOLDER=Meet Recordings
GOOGLE_DRIVE_NOTIFICATION_CHANNEL=C1234567890 # Optional: Slack channel
GOOGLE_DRIVE_POLL_INTERVAL=30
```

### 3. First-time Authentication

```bash
sa meet-watch
```

- A browser will open asking you to log in
- Grant Drive read permissions
- `token.json` will be automatically created
- Future runs will use the saved token

### 4. Verify "Meet Recordings" Folder

- Go to [Google Drive](https://drive.google.com)
- Check if "Meet Recordings" folder exists
- If not, record one test meeting in Google Meet to create it

### 5. Usage

**Automatic mode (recommended):**

```bash
# Run in background - watches for new recordings
sa meet-watch

# Or with custom poll interval
sa meet-watch --poll-interval 60
```

Then just:
1. Start recording in Google Meet
2. Have your meeting
3. Stop recording
4. Wait ~1-2 minutes → Summary arrives in Slack!

**Manual mode:**

```bash
# Transcribe any audio file
sa meet-upload meeting.mp3
sa meet-upload zoom_call.wav --transcript-only
sa meet-upload recording.m4a --language ko
```

### Performance

**Whisper large-v3-turbo (GPU):**
- 10min meeting: ~8-10 seconds
- 30min meeting: ~25-30 seconds
- 60min meeting: ~50-60 seconds

**CPU only:**
- 10min meeting: ~30-45 seconds
- 30min meeting: ~1.5-2 minutes
- 60min meeting: ~3-4 minutes

### Cost

| Component | Cost |
|-----------|------|
| Recording | $0 (Google One) or $0 (any audio source for manual upload) |
| Transcription | $0 (Local Whisper) |
| API | $0 (OAuth) |
| **Total** | **$0** |

*Note: Google Meet recording requires Google Workspace Business+ ($12/user/mo) or Google One Premium (2TB, $9.99/mo for family plan). Alternatively, use manual upload for any audio source (Zoom, Teams, phone recordings, etc.).*
>>>>>>> ca1ecd66bcded4e2c871798d5429a9eaae46bc8b
7 changes: 7 additions & 0 deletions pyproject.toml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ dependencies = [
"typer>=0.12.0",
"rich>=13.0.0",
"mcp-atlassian",
"google-api-python-client>=2.100.0",
"google-auth>=2.23.0",
"slack-bolt>=1.18.0",
"google-auth>=2.28.0",
"google-auth-oauthlib>=1.2.0",
"google-api-python-client>=2.116.0",
"faster-whisper>=1.0.0",
"slack-sdk>=3.23.0",
]

[project.optional-dependencies]
Expand Down
Loading