# AIZU-CLI — Fitur Lengkap v2.1.0

## 1. Multi-Backend AI

AIZU-CLI support beberapa backend AI:

| Backend | Default Model | Biaya | Butuh Key |
|---------|--------------|-------|-----------|
| **Groq** | llama-3.3-70b-versatile | Gratis (free tier) | Ya |
| **OpenAI** | gpt-4o-mini | Bayar | Ya |
| **Gemini** | gemini-2.0-flash | Gratis (free tier) | Ya |
| **OpenRouter** | llama-3.3-70b-instruct | Sebagian gratis | Ya |
| **Ollama** | llama3.2:1b | Gratis, offline | Tidak |
| **Custom** | User specify | Tergantung | Ya |

## 2. Tools (35+ tools + Cache + Parallel)

### File Tools
| Tool | Fungsi |
|------|--------|
| `read_file` | Baca isi file |
| `write_file` | Tulis/timpa file |
| `edit_file` | Edit bagian file |
| `list_dir` | Lihat isi direktori |
| `search_files` | Cari file (glob/regex) |
| `get_file_info` | Info file (size, modified) |
| `grep` | Cari teks dalam file |
| `copy_file` | Copy file |
| `move_file` | Pindah/rename file |
| `delete_file` | Hapus file |
| `mkdir` | Buat direktori |

### Web Tools
| Tool | Fungsi |
|------|--------|
| `web_search` | Cari di internet (DuckDuckGo) |
| `web_fetch` | Ambil konten URL |
| `fetch_url` | Fetch URL (HTML/text) |
| `fetch_json` | Fetch JSON API |

### Git Tools
| Tool | Fungsi |
|------|--------|
| `git_status` | Status repo |
| `git_log` | Log commit |
| `git_diff` | Lihat diff |
| `git_add` | Tambah ke staging |
| `git_commit` | Commit |
| `git_push` | Push ke remote |
| `git_pull` | Pull dari remote |
| `git_branch` | Lihat/buat branch |
| `git_checkout` | Pindah branch |

### Shell Tools
| Tool | Fungsi |
|------|--------|
| `run_shell` | Jalankan command (streaming) |

### Memory Tools
| Tool | Fungsi |
|------|--------|
| `memory_save` | Simpan fakta/preferensi |
| `memory_get` | Ambil memory |
| `memory_list` | List semua memory |
| `memory_search` | Cari memory (smart recall) |
| `memory_delete` | Hapus memory |

### GitHub Tools
| Tool | Fungsi |
|------|--------|
| `github_get_repo` | Info repo |
| `github_list_issues` | List issues |
| `github_get_issue` | Detail issue |
| `github_list_prs` | List pull requests |
| `github_search_repos` | Search repos |
| `github_get_user` | Info user |

### Other Tools
| Tool | Fungsi |
|------|--------|
| `calculate` | Kalkulasi matematika |

### ToolCache (v2.1.0)
- **TTL**: 5 menit cache expiry
- **Max entries**: 100
- **Eviction**: LRU (Least Recently Used)
- **Key**: MD5 hash dari tool name + arguments

### ToolExecutor (v2.1.0)
- **Parallel execution**: ThreadPoolExecutor
- **Batch tools**: Jalankan beberapa tool sekaligus

## 3. Plugin System (4 Tipe + Hot-Reload + Sandbox)

### Tool Plugin
Tambah tools baru ke AIZU-CLI.

### Backend Plugin
Tambah backend AI baru.

### Mode Plugin
Tambah mode kerja baru.

### Command Plugin
Tambah slash commands baru.

### Lifecycle Hooks
- `on_startup` / `on_shutdown`
- `before_tool` / `after_tool`
- `before_llm` / `after_llm`
- `on_message` / `on_error`

### Hot-Reload (v2.1.0)
- Background thread watch file modification times
- Auto-reload plugin yang berubah
- `start_hot_reload(interval)` / `stop_hot_reload()`

### Plugin Sandboxing (v2.1.0)
- Blokir: `exec`, `eval`, `compile`, `__import__`
- Blokir module: `subprocess`, `os.system`, `shutil`
- `_check_sandbox()` sebelum eksekusi

### Thread Safety (v2.1.0)
- `threading.RLock()` untuk semua operasi
- Safe untuk concurrent access

### 9 Included Plugins
| Plugin | Tipe | Fungsi |
|--------|------|--------|
| calculator | tool | Hitung matematika |
| filesystem | tool | File operations lengkap |
| github | tool | GitHub API |
| brave-search | tool | Web search |
| fetch | tool | Fetch URL/JSON |
| memory | tool | Memory CRUD |
| my-backend | backend | Contoh custom backend |
| my-command | command | Contoh custom commands |
| my-mode | mode | Contoh custom modes |

## 4. Sub-Agents

| Tipe | Fungsi |
|------|--------|
| `explore` | Eksplorasi kode |
| `code-reviewer` | Review kode |
| `implementer` | Implementasi fitur |
| `general` | Umum |

### Background Agents
```bash
/agent --bg <task>     # Jalankan di background
/agents                # Lihat status
```

## 5. Mode Kerja (7 mode)

| Mode | Fungsi |
|------|--------|
| `chat` | Asisten umum (default) |
| `code` | Fokus kode |
| `ringkas` | Singkat saja |
| `shell` | Fokus terminal |
| `detail` | Lengkap & mendalam |
| `git` | Fokus git |
| `belajar` | Mode belajar |

## 6. Slash Commands (28+ commands)

| Command | Fungsi |
|---------|--------|
| `/help` | Tampilkan bantuan |
| `/config` | Lihat pengaturan |
| `/backend <nama>` | Ganti backend |
| `/provider` | Setup provider custom |
| `/providers` | Pilih provider tersimpan |
| `/key <api-key>` | Atur API key |
| `/model <nama>` | Atur model |
| `/models [kata]` | Cari & pilih model |
| `/url <base-url>` | Atur base URL |
| `/mode [nama]` | Ganti mode |
| `/tools` | Daftar tool |
| `/save` | Simpan config |
| `/sessions` | Lihat session |
| `/resume <nama>` | Resume session |
| `/save-session` | Simpan session |
| `/delete-session` | Hapus session |
| `/permissions` | Atur permission |
| `/plugins` | Lihat plugin |
| `/agent <task>` | Jalankan sub-agent |
| `/agents` | Lihat background agents |
| `/plan` | Toggle plan mode |
| `/tasks` | Kelola task list |
| `/memory` | Kelola memory |
| `/skill <name>` | Invoke skill |
| `/schedule` | Kelola scheduled tasks |
| `/data-user` | Kelola data profil user (NEW) |
| `/reset` | Hapus riwayat |
| `/keluar` | Keluar |

## 7. Memory System (Smart Recall v2.1.0)

### Tipe Memory
| Tipe | Fungsi |
|------|--------|
| `user` | Siapa user (role, expertise, preferences) |
| `feedback` | Guidance dari user |
| `project` | Ongoing work, goals, constraints |
| `reference` | Pointer ke external resources |

### Fitur
- Cross-linking dengan `[[name]]` syntax
- `MEMORY.md` index file
- Full-text search

### smart_recall() (v2.1.0)
- **TF-IDF weighted search**: Term frequency * inverse document frequency
- **Recency boosting**: < 7 hari = 1.5x, < 30 hari = 1.2x
- **Type-based boosting**: user=1.3x, feedback=1.2x, project=1.0x, reference=0.8x

### deduplicate() (v2.1.0)
- Fuzzy string matching (Jaccard similarity)
- Threshold 0.8 untuk merge

### garbage_collect() (v2.1.0)
- Cleanup by age (max 90 hari)
- Cleanup by access count
- Max limit 100 entries

### auto_extract() (v2.1.0)
- Pattern matching untuk auto-detect preferences, decisions, facts
- Support bahasa Indonesia dan Inggris

## 8. Skills System (7 Built-in)

| Skill | Fungsi |
|-------|--------|
| `review-code` | Review kode |
| `explain-code` | Jelaskan kode |
| `debug` | Debug error |
| `write-tests` | Buat unit tests |
| `refactor` | Refactor kode |
| `commit` | Buat commit message |
| `docs` | Buat dokumentasi |

## 9. Task Management

```bash
/tasks                      # Lihat task list
/tasks create <desc>        # Buat task baru
/tasks update <id> <status> # Update status
/tasks delete <id>          # Hapus task
```

Status: `pending` -> `in_progress` -> `completed`

## 10. Workflow Orchestration (v2.1.0 Enhanced)

- **Pipeline** — Stage-by-stage execution
- **Parallel** — Concurrent execution
- **Background** — Non-blocking execution

### WorkflowManager (v2.1.0)
- Save/load/list/delete ke `~/.aizu/workflows/`
- Execution history tracking (max 100 entries)

### BackgroundWorkflowRunner (v2.1.0)
- Non-blocking execution dengan threading
- Progress callbacks
- Cancellation support
- Timeout wait

## 11. MCP Bridge (v2.1.0 Enhanced)

Support Model Context Protocol:
- **stdio** — Subprocess transport
- **SSE** — Server-Sent Events transport
- Tool discovery & execution

### Windows Support (v2.1.0)
- Threading-based I/O (select.select tidak support pipes di Windows)
- STARTUPINFO untuk hide console window

### SSE Auto-Reconnect (v2.1.0)
- Exponential backoff (max 3 retries)
- `Last-Event-ID` header untuk resume connection
- Content-Type detection (JSON vs SSE)

## 12. Responsive TUI (v2.1.0)

### 3-Region Layout
- TOP: Workspace/Progress (fixed)
- MIDDLE: Chat (scrollable)
- BOTTOM: Status/Input (fixed)

### Slash Autocomplete
- 28+ commands dengan fuzzy matching
- Windows: msvcrt (character-by-character)
- Unix: termios
- Fallback: input() biasa
- Navigasi: Arrow Up/Down, Tab autocomplete, Enter submit

### ClaudeStyleTUI
- Thinking indicator
- Tool progress display
- Markdown rendering

## 13. User Data Management (NEW v2.1.0)

### Data yang Dikelola
| Tipe | Field |
|------|-------|
| **Profil** | nama, TTL, alamat, HP, email, agama, status, kewarganegaraan |
| **Pendidikan** | jenjang, institusi, jurusan, tahun, IPK |
| **Pengalaman** | posisi, perusahaan, tahun, deskripsi |
| **Keahlian** | list skill |
| **Sertifikat** | nama, penerbit, tahun |
| **Dokumen** | foto, ijazah, CV, transkrip, KTP, SKCK |

### Slash Commands
```bash
/data-user                    # Tampilkan bantuan
/data-user setup <folder>     # Setup data folder
/data-user lihat              # Lihat profil lengkap
/data-user edit <field> <val> # Edit data profil
/data-user tambah-pendidikan  # Tambah pendidikan
/data-user tambah-pengalaman  # Tambah pengalaman
/data-user tambah-keahlian    # Tambah keahlian
/data-user tambah-sertifikat  # Tambah sertifikat
/data-user dokumen <n> <path> # Simpan dokumen
/data-user surat <pos> <org>  # Generate surat lamaran PDF
```

### Storage
- Data: `~/.aizu/user_data/profile.json`
- Dokumen: `<folder_user>/foto/`, `dokumen/`, `sertifikat/`, `ijazah/`, `cv/`

## 14. PDF Generator (NEW v2.1.0)

### generate_surat.py
- Generate surat lamaran kerja PDF
- Menggunakan reportlab library
- 2 halaman: surat lamaran + lampiran data diri
- Auto-include: biodata, pendidikan, pengalaman, keahlian, sertifikat

### Cara Pakai
```bash
/data-user surat "Backend Developer" "PT ABC Indonesia"
```

### Output
- File PDF di folder data user
- Format: `surat-lamaran-{perusahaan}-{tanggal}.pdf`

## 15. Animasi Dinamis Modern

### Thinking
```
Berputar -> Menalar -> Memahami konteks -> Menghubungkan ide
```

### Analyzing
```
Menganalisis -> Memeriksa struktur -> Mengevaluasi
```

### Working
```
Mengerjakan -> Menyiapkan -> Memproses
```

### Searching
```
Mencari -> Scanning -> Mengambil data
```

## 16. Token Usage & Cost

```
Tokens: 1,234 | Cost: $0.0005 (Rp 7.90)
```

Support USD dan Rupiah (kurs real-time).

## 17. Context Compression (Smart Strategy v2.1.0)

### Strategi
- **SMART**: Sliding window dengan importance scoring (default)
- **SIMPLE**: Simpan 5 pesan terakhir + summary
- **AGGRESSIVE**: Hanya system prompt + 3 pesan terakhir

## 18. Permission System

| Level | Fungsi |
|-------|--------|
| `auto` | Langsung eksekusi |
| `ask` | Tanya dulu (3 opsi) |
| `deny` | Blokir total |

3 opsi saat `ask`:
1. Izinkan sekali
2. Izinkan selalu (sampai sesi berakhir)
3. Tidak diizinkan



## 19. Telegram Bridge (NEW v2.1.0)

### Fitur
- Kirim file PDF (surat lamaran) ke Telegram user
- Sistem linking kode: user akses bot -> minta kode -> masukkan di AIZU -> linked
- Polling /getUpdates untuk menerima pesan
- Zero external dependencies (pakai urllib)

### Cara Setup
1. Buat bot di Telegram via @BotFather
2. Dapatkan bot token
3. Jalankan: /telegram start <bot_token>
4. Buka Telegram, kirim /start ke bot
5. Kirim /link ke bot untuk dapat kode
6. Di AIZU-CLI: /telegram link <kode>

### Slash Commands
- /telegram start <bot_token> - Set token & mulai polling
- /telegram stop - Stop polling
- /telegram status - Cek status detail
- /telegram link <kode> - Verifikasi kode linking
- /telegram unlink <chat_id> - Putuskan linking
- /telegram send <id> <msg> - Kirim pesan

## 20. Comparison dengan Claude Code

| Fitur | AIZU-CLI | Claude Code |
|-------|----------|-------------|
| Multi-backend | ✅ | ❌ |
| Real-time streaming | ✅ | ✅ |
| Token display | ✅ | ✅ |
| Context compression | ✅ (smart) | ✅ |
| Dynamic animations | ✅ | ✅ |
| Plugin system | ✅ (4 tipe + sandbox) | ✅ |
| Sub-agents | ✅ (worktree) | ✅ |
| Hooks | ✅ (8 lifecycle) | ✅ |
| Memory | ✅ (smart recall) | ✅ |
| Tool cache | ✅ (TTL + LRU) | ✅ |
| Skills | ✅ (7 built-in) | ✅ |
| Scheduler | ✅ (cron) | ✅ |
| Tasks | ✅ | ✅ |
| Workflow | ✅ (persistence) | ✅ |
| MCP Bridge | ✅ (Windows) | ✅ |
| User data | ✅ | ❌ |
| PDF generator | ✅ | ❌ |
| Harga | **Gratis** | Berbayar |
