npm package: @lim-labs/lim
Description: Finance OS for the command line
Latest version: 0.3.0

# @lim-labs/lim

Finance OS for the command line. Natural language journal entries with a learning engine.

Like having a veteran tax advisor on call — describe the transaction and lim handles the accounting.

## Install

```bash
npm install -g @lim-labs/lim
```

This package targets the production environment by default.

For local development only, you can override the endpoints with environment variables:

```bash
LIM_API_URL=http://localhost:3000 LIM_WEB_URL=http://localhost:3001 lim doctor
```

The published CLI does not advertise non-production endpoints. Endpoint overrides are intended for local development and internal validation only.

## Quick Start

```bash
# Login
lim auth login

# Select a company
lim companies list
lim companies use my-startup-inc
lim companies show

# Add a journal entry with natural language
lim add "AWS 11000 yen credit card"
# => ✅ Communication 10,000 / Accounts payable 11,000
#       Input VAT 1,000
#    📚 Learned rule for "AWS" (auto-suggest next time)

# Attach a receipt photo
lim add "expense" --file receipt.jpg
```

## Commands

### Authentication

```bash
lim auth login                         # Login via browser (OAuth)
lim auth logout                        # Logout and clear credentials
lim auth whoami                        # Show current user
```

### Company Management

```bash
lim companies list                     # List companies (shows active)
lim companies use <slug>               # Set active company by slug, ID, or exact name
lim companies show                     # Show active company profile
lim companies create --name "Acme" --slug acme  # Create a new company
lim companies update --timezone Asia/Tokyo      # Update active company profile
```

### Natural Language Journal (`add`)

```bash
lim add "description"                 # Text-based entry
lim add "expense" --file receipt.jpg  # From receipt photo
lim add "invoice" --file invoice.pdf  # From PDF invoice
lim add "purchase" --file screenshot.png
```

## Release

Versioning is managed with Changesets and publishing is triggered by git tags.

```bash
pnpm changeset
pnpm version-packages
git add .
git commit -m "chore: release v0.1.0"
git tag v0.1.0
git push origin main --tags
```

- 3-step judgment: rule match → history match → AI (Claude Haiku 4.5)
- Learns from confirmed entries — skips AI next time
- Tax-inclusive amount decomposition (10% / 8% reduced rate)
- Supports PNG, JPG, GIF, WebP, PDF attachments
- Auto-resize images to 1568px for fast processing

### Journal Entries

```bash
lim journals list                      # List entries (with filters)
lim journals list --from 2026-01 --status posted --limit 20
lim journals show <seq|id>             # Show entry details
lim journals create --date 2026-01-15 --debit 1100:50000 --credit 4100:50000
lim journals edit 42 --date 2026-03-20 --memo "Fix"  # Edit draft entries
lim journals reverse --id 5            # Reverse entries (preview + confirm)
lim journals reverse --from 2026-03-01 --to 2026-03-31  # Reverse by filter
lim journals delete --id 4 --id 5     # Delete draft entries
lim journals update-tax-code           # Update tax codes on journal lines
```

### Chart of Accounts

```bash
lim accounts list                      # List all accounts
lim accounts list --tree               # Tree view
lim accounts show <code>               # Show account details
```

### Financial Reports

```bash
lim reports tb --from 2026-01-01 --to 2026-12-31    # Trial balance
lim reports pl --from 2026-01-01 --to 2026-12-31    # Profit & loss
lim reports bs --as-of 2026-12-31                    # Balance sheet
lim reports ss                                       # Shareholders' equity
lim reports aging                                    # Receivables aging
lim reports cs                                       # Cash flow statement
lim reports gl --from 2026-01 --to 2026-12           # General ledger
lim reports subsidiary-summary                       # Subsidiary ledger summary
lim reports tax                                      # Tax report
```

### Dashboard & Stats

```bash
lim dashboard show                     # Dashboard overview
lim dashboard flywheel                 # Learning flywheel stats (manual vs automated)
lim dashboard runway                   # Cash runway calculation
lim dashboard pnl                      # Current month P&L summary
lim stats                              # Learning engine metrics
```

### Invoices

```bash
lim invoices list                      # List invoices
lim invoices show <id>                 # Show invoice details
lim invoices create                    # Create an invoice
lim invoices send <id>                 # Send/issue an invoice
lim invoices pay <id>                  # Record payment
lim invoices void <id>                 # Void an invoice
lim invoices convert <id>              # Convert quote to invoice
```

### Contracts

```bash
lim contracts list                     # List contracts
lim contracts check                    # Run integrity checks
lim contracts deadlines                # Upcoming deadlines
lim contracts generate --month 2026-03 # Generate recurring entries
lim contracts generate --month 2026-03 --dryRun  # Preview only
```

### Employees

```bash
lim employees list                     # List employees
lim employees list --status active     # Filter by status
lim employees show <id>               # Show employee details
lim employees add                      # Add an employee
lim employees update <id>             # Update employee info
```

### Payroll

```bash
lim payroll list                       # List payroll runs
lim payroll show <id>                 # Show payroll details
lim payroll run                        # Run payroll calculation
lim payroll confirm <id>              # Confirm and generate journal entries
lim payroll paid <id>                 # Mark payroll as paid
```

### Fixed Assets

```bash
lim assets list                        # List fixed assets
lim assets add                         # Register a new asset
lim assets depreciate --month 2026-03  # Run monthly depreciation
lim assets dispose                     # Dispose an asset (除却)
lim assets sell                        # Sell an asset (売却)
```

### Banking & Reconciliation

```bash
lim bank list                          # List bank accounts
lim bank create --name "Main Account"  # Create a bank account
lim bank show <id>                     # Show bank account details
lim bank transactions <id>             # List transactions
lim bank transactions <id> --status unmatched
lim bank match <bankId> <txId> --accountId <acctId>   # Match to new entry
lim bank link <bankId> <txId> --journalEntryId <jeId> # Link to existing entry
lim bank unmatch <bankId> <txId>       # Unmatch a transaction
lim bank exclude <bankId> <txId> --status excluded
lim bank auto-match <id>              # Auto-match transactions
lim bank reconciliation <id>          # Reconciliation report
lim bank reconciliation <id> --asOf 2026-03-31
```

### Period Management

```bash
lim close month 2026-02                # Monthly close
lim close month 2026-02 --check        # Dry-run checklist only
lim close month 2026-02 --force        # Force close with warnings
lim close year 2025                    # Year-end close
lim reopen 2026-02                     # Reopen a closed period
```

### Foreign Exchange

```bash
lim fx rate                            # Show/set exchange rates
lim fx revalue                         # Run FX revaluation
```

### Labels

```bash
lim labels list                        # List all labels
lim labels list --type partner         # Filter by type
lim labels create --type tag --name "R&D"
lim labels update <id> --name "Research"
lim labels update <id> --archived true # Archive a label
```

### Tax Codes

```bash
lim tax-codes list                     # List all tax codes
lim tax-codes create --code T10 --name "10% taxable" --rate 0.10 --taxType taxable --category purchase
```

### Company Members

```bash
lim members list                       # List company members
```

### Approval Workflows

```bash
lim approvals policies                 # List approval policies
lim approvals create-policy --name "Large transactions" --conditions '{"amountGte":100000}'
lim approvals pending                  # List pending approvals
lim approvals approve <recordId>       # Approve
lim approvals reject <recordId> --comment "Need receipt"
```

### Withholding Tax

```bash
lim withholding calculate --amount 100000   # Calculate withholding
lim withholding summary --year 2026         # Annual summary
lim withholding summary --year 2026 --labelId <partnerId>
```

### Expense Reports

```bash
lim expenses list                      # List expense reports
lim expenses list --status submitted --period 2026-03
lim expenses show <id>                 # Show report details
lim expenses create --submitterId <uid> --title "March expenses" --period 2026-03
lim expenses add-item <id> --date 2026-03-01 --description "Taxi" --amount 3000 --accountId <acctId>
lim expenses remove-item <id> <itemId> # Remove an item
lim expenses submit <id>               # Submit for approval
lim expenses approve <id>              # Approve
lim expenses reject <id> --comment "Missing receipt"
lim expenses resubmit <id>             # Resubmit after rejection
lim expenses reimburse <id> --bankAccountId <baId> --date 2026-03-25
```

### Scenario Analysis

```bash
lim scenarios list                     # List scenarios
lim scenarios show <id>                # Show scenario details
lim scenarios create --name "Growth plan" --baseDate 2026-04-01
lim scenarios generate <id>            # Generate scenario entries
lim scenarios apply <id>               # Apply to live ledger
lim scenarios discard <id>             # Discard scenario
lim scenarios diff <id> --from 2026-01-01 --to 2026-12-31
```

### Accrual Schedules

```bash
lim accruals list                      # List accrual schedules
lim accruals list --status active
lim accruals create --type prepaid_expense --totalAmount 120000 --startDate 2026-01-01 --endDate 2026-12-31 --expenseAccountId <id> --balanceAccountId <id>
lim accruals process --month 2026-03   # Process accruals for a month
lim accruals process --month 2026-03 --dryRun  # Preview only
```

### Audit Events

```bash
lim events list                        # List recent events
lim events list --entityType journal_entry --limit 20
lim events list --actorType user
```

### Import & Export

```bash
lim import                             # Import CSV data
lim import --opening-balance           # Import opening balances
lim import --health-check              # Validate import data
lim import --undo                      # Undo last import
lim export etax                        # Export e-Tax XML
lim export account-details             # Export account details (勘定科目内訳明細書)
```

### Document Management (電子帳簿保存法)

```bash
lim docs list                          # List documents
lim docs show <id>                     # Show document details
lim docs upload --file invoice.pdf     # Upload a document
```

## AI Agent Integration

### Claude Code Skills

```bash
npx skills add @lim-labs/lim
# or
npx @lim-labs/lim skills add
```

Syncs lim commands as Claude Code skills. Claude can then suggest and execute lim commands contextually.

### MCP Server

```bash
npx @lim-labs/lim mcp add
```

Registers lim as an MCP server for Claude Code. All 29 command groups become available as tools — Claude can add journal entries, pull trial balances, manage bank reconciliation, run scenarios, and more.