$npx -y skills add adityahimaone/hermes-agent-rtk-caveman --skill zenith-finance-syncAuto-sync Zenith Finance data (transactions, ledger) to Google Sheets. Creates/updates a spreadsheet with Dashboard and History sheets.
| 1 | # Zenith Finance to Google Sheets Auto-Sync Skill |
| 2 | |
| 3 | ## Purpose |
| 4 | Automatically synchronizes Zenith Finance transaction data and ledger balances to a Google Sheets spreadsheet with: |
| 5 | - Dashboard sheet: Summary metrics, charts-ready data with correct formulas |
| 6 | - History sheet: Complete transaction log with timestamps |
| 7 | |
| 8 | ## Enhanced Features |
| 9 | - Correctly references Category column (D) for income/expense calculations |
| 10 | - Account balances calculated as Income - Expense per account |
| 11 | - Robust transaction handling with duplicate prevention |
| 12 | - Extended dashboard with monthly summaries and detailed accounting |
| 13 | - Preserves custom formulas in Dashboard cells (especially B2 and B3 for Income/Expense SUMIFs) by using user-specified column references in the sync script |
| 14 | - Supports enhanced pipe-separated Transactions.md format: [timestamp] | description | amount | Income/Expense | Category | Source | Balance |
| 15 | - **ENHANCED**: Now includes actual Category field (Food/Transport/etc.) in Google Sheets Column E for detailed tracking |
| 16 | - Updated to sync 7 columns: Timestamp, Description, Amount, Income/Expense, Category, Source, Balance |
| 17 | |
| 18 | ## Prerequisites |
| 19 | 1. Google Workspace skill must be authenticated with scopes including: |
| 20 | - https://www.googleapis.com/auth/spreadsheets |
| 21 | - https://www.googleapis.com/auth/drive |
| 22 | 2. Zenith Finance data must exist in ~/Documents/Obsidian/Notes/Finance/ |
| 23 | |
| 24 | ## Configuration |
| 25 | The skill stores the target spreadsheet ID in: |
| 26 | - ~/.hermes/zenith_spreadsheet_id.txt |
| 27 | - Can be overridden by setting ZENITH_SPREADSHEET_ID environment variable |
| 28 | |
| 29 | ## Workflow |
| 30 | 1. Check if Google authentication is valid |
| 31 | 2. Load Zenith Finance data from Ledger.md and Transactions.md |
| 32 | 3. If no target spreadsheet exists, create one with Dashboard and History sheets |
| 33 | 4. Append new transactions to History sheet (since last sync) |
| 34 | 5. Update Dashboard summary metrics |
| 35 | 6. Record sync timestamp for next run |
| 36 | |
| 37 | ## Troubleshooting\n\n### Regex Pattern Issues\nIf encountering \"bad character range\" errors in parse_transactions_file:\n1. **Timestamp regex** (around line 91): Should be `r'$$\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$$'` to match `[2026-04-07 21:32]`\n2. **Transaction parser** (around line 109): Should be `r'$$(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})$$\\s*\\|\\s*(.+?)\\s*\\|\\s*(.+?)\\s*\\|\\s*(.+?)\\s*\\|\\s*(.+)'`\n3. **Amount extraction** (around line 117): Should be `r'-\\s*Rp([\\d,.]+)$'` to extract amounts like \"- Rp12345.67\"\n4. **Amount/Balance cleaning** (around lines 126, 134): Should be `re.sub(r'[Rp,\\s]', '', string)` to remove Rp, commas, and spaces\n\n### String Escaping Issues\nIf encountering \"unexpected character after line continuation character\" errors:\n- Check print statements for incorrectly escaped quotes\n- Should be `print(f\"Warning: message {variable}\")` not `print(f\\\"Warning: message {variable}\\\")`\n\n### PATH Construction Issues\nIf seeing \"google_token.json not found\" errors despite file existing:\n- Check TOKEN_PATH assignment - should be `Path(HERMES_HOME) / \"google_token.json\"` not malformed concatenation\n\n### Sync State Issues\nIf load_sync_state() errors occur:\n- Ensure the sync state file (~/.hermes/zenith_sync_state.json) contains valid JSON\n- Is absent for first run (will be created after successful sync)\n\n### Google Auth Problems\nIf API calls fail with authentication errors:\n- Re-authenticate using the google-workspace-setup skill\n- Verify token file exists at ~/.hermes/google_token.json\n- Ensure required scopes are granted: spreadsheets and drive |
| 38 | Trigger this skill after any Zenith Finance transaction is recorded, or run manually to sync all data. |
| 39 | |
| 40 | ## Data Mapping |
| 41 | **History Sheet Columns:** |
| 42 | - Timestamp: ISO format from transaction |
| 43 | - Description: Transaction description/item |
| 44 | - Amount: Numeric amount (positive for income, negative for expense) |
| 45 | - Category: Transaction category (Income, Expense) |
| 46 | - Source: Account involved (BCA, Gopay, Dompet, etc.) |
| 47 | - Balance: Running net worth after transaction |
| 48 | |
| 49 | **Dashboard Sheet:** |
| 50 | - Metrics: Total Income, Total Expenses, Net Savings, Last Updated |
| 51 | - Formulas that auto-calculate from History data |
| 52 | |
| 53 | ## Implementation |
| 54 | This skill uses the `scripts/sync.py` script to perform the actual synchronization. The script handles robust parsing of Transactions.md format in two versions: |
| 55 | |
| 56 | ### Legacy Format (still supported): |
| 57 | - Multiple transactions may appear on the same line without separators |
| 58 | - Transaction descriptions follow the format \"Description - RpAmount\" where the amount needs extraction |
| 59 | - Special formats like \"-RpAmount\" (without description dash) are handled for consistency |
| 60 | |
| 61 | ### New Pipe-Separated Format (current): |
| 62 | - Each transaction on its own line: [timest |