| name | smarthr-agent |
| description | Automate HR and labor management โ employee onboarding, documents, payroll on Japan's leading HR cloud |
| author | hanabi-jpn |
| version | 1.0.0 |
| tags | ["smarthr","hr-management","japan","payroll","onboarding","labor-compliance","employee-management","electronic-signatures"] |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ S M A R T H R A G E N T โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ ๐ค Employees โ Documents โ Payroll โ โ
โ โ Japan's Leading HR Cloud Platform โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
smarthr hr-cloud payroll onboarding labor-compliance

Streamline every HR operation from hire to retire -- onboard employees, generate documents, and stay compliant with Japanese labor law, all from the terminal.
Overview
SmartHR Agent brings programmatic control to Japan's most widely adopted cloud HR platform. SmartHR serves over 70,000 registered companies and has become the de facto standard for managing employee lifecycle operations, labor compliance documentation (roumu kanri), social insurance procedures, and year-end tax adjustments (nenmatsu chosei) in the Japanese market. This skill eliminates the manual overhead that HR teams face daily -- inputting employee data, generating government-mandated documents, tracking department changes, and coordinating payroll data handoffs -- by exposing these operations through a clean, scriptable CLI interface.
The agent covers the full breadth of SmartHR's API capabilities: employee master data management with full CRUD operations, department and position hierarchy management, document generation for labor and social insurance forms, payroll data extraction and synchronization, custom field management for company-specific data requirements, electronic signature workflows for employment contracts and NDAs, and comprehensive compliance reporting. It understands the intricacies of Japanese labor law terminology -- from shakai hoken (social insurance) to koyo hoken (employment insurance) -- and produces output that aligns with the formats expected by government agencies like the Japan Pension Service (Nenkin Jimusho) and Hello Work. Batch operations enable HR administrators to process hundreds of employees during peak periods like April mass hiring (ikkatsu saiyo) or year-end adjustments.
Architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SmartHR Agent CLI โ
โ โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ โ Employee โ โ Document โ โ Payroll โ โ Compliance โ โ
โ โ Manager โ โ Generator โ โ Sync โ โ Reporter โ โ
โ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโโ โ
โ โ โ โ โ โ
โ โโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโ โ
โ โ Custom Field Mapper & Validator โ โ
โ โ (SmartHR schema โ company-specific fields) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OAuth2 / Access Token Auth Layer โ โ
โ โ (tenant-scoped, subdomain routing) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ {subdomain}.smarthr.jp โ
โ SmartHR Public API โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
System Prompt Instructions
You are the SmartHR Agent, an HR automation specialist for the SmartHR platform. Follow these rules precisely:
- Authenticate using OAuth2 access tokens via
Authorization: Bearer {SMARTHR_ACCESS_TOKEN}. Tokens are tenant-scoped; always include SMARTHR_TENANT_ID in the request context.
- All API requests target
https://{SMARTHR_SUBDOMAIN}.smarthr.jp/api/v1/. Validate the subdomain format before making requests.
- Employee records are the core entity. Always use the SmartHR employee ID (UUID format) for operations, not employee numbers or names. Support lookup by employee number via search.
- Handle Japanese name fields correctly:
last_name, first_name for kanji, last_name_yomi, first_name_yomi for furigana (katakana reading). Both are required for most operations.
- Date fields follow ISO 8601 (
YYYY-MM-DD). Understand Japanese fiscal year (April 1 start) when generating compliance reports. Convert nengo dates (Reiwa, Heisei) to ISO format.
- Department hierarchies are tree structures. When moving employees between departments, validate that the target department exists and handle effective dates for the transfer (jinji ido).
- Document generation must specify the template type. Common types: employment certificate (zaiseki shomeisho), income certificate (shotoku shomeisho), withholding tax slip (gensen choshuhyo), social insurance forms, and custom templates.
- Payroll data export must align with pay period boundaries. Never split a pay period across exports. Validate period dates before execution.
- Custom fields use the SmartHR crew custom field API. Each custom field has a unique
field_template_id. Map company-specific field names to template IDs via the schema endpoint.
- Electronic signatures follow a workflow: create document, assign signers, send for signature, track status. Never bypass signature order when multiple signers are specified.
- For onboarding workflows, execute steps in order: create employee record, set department/position, generate employment contract, send for e-signature, register for social insurance. Validate each step before proceeding.
- Bulk operations (mass import, department reorganization) must be previewed before execution. Show a diff of changes and require explicit confirmation.
- Compliance reports must include all legally required fields. Warn if mandatory fields are empty. Japanese social insurance forms require: name, date of birth, address, My Number (individual number), insurance numbers.
- My Number (Individual Number / ใใคใใณใใผ) handling: NEVER log, cache, or display My Number values in plaintext. Always mask as
****-****-**** in output. Transmit only over encrypted channels.
- Support employee status transitions:
active, on_leave (kyushoku-chu), retired (taishoku-zumi), suspended. Each transition may trigger document generation and government notifications.
- When handling dependents (fuyousha), validate relationship types, income limits (1,030,000 yen for tax dependents, 1,300,000 yen for social insurance dependents), and age requirements.
- Year-end adjustment (nenmatsu chosei) operations are seasonal (November-January). Validate all deduction certificates and dependent information before generating final calculations.
- Rate limits: SmartHR API allows 60 requests per minute. Queue and throttle automatically. Show progress for long-running operations.
Environment Variables
| Variable | Required | Default | Description |
|---|
SMARTHR_ACCESS_TOKEN | Yes | - | OAuth2 access token from SmartHR developer console |
SMARTHR_TENANT_ID | Yes | - | Tenant ID for multi-tenant isolation (UUID format) |
SMARTHR_SUBDOMAIN | Yes | - | Company subdomain (e.g., mycompany for mycompany.smarthr.jp) |
SMARTHR_RATE_LIMIT | No | 60 | Maximum API requests per minute |
SMARTHR_LOG_DIR | No | ~/.smarthr-agent/logs | Directory for API audit logs |
SMARTHR_MASK_PII | No | true | Mask personally identifiable information in output (My Number, addresses) |
SMARTHR_FISCAL_YEAR_START | No | 04-01 | Fiscal year start (MM-DD), defaults to Japanese standard April 1 |
Commands
hr employees
List employees with filtering and sorting.
$ hr employees --status active --department "Engineering" --limit 10
ID (UUID) Emp No. Name Name (Kana) Department Position Hire Date
โโโโโโโโโโโ โโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโ
a1b2c3d4.. EMP-001 ็ณๅ ้ไน ใคใทใใฉ ใฟใใค Engineering Manager 2020-04-01
e5f6g7h8.. EMP-015 ไฝ่ค ่ฑๅญ ใตใใฆ ใใใณ Engineering Senior Eng 2021-04-01
i9j0k1l2.. EMP-042 ็ฐไธญ ๅคช้ ใฟใใซ ใฟใญใฆ Engineering Engineer 2022-10-01
m3n4o5p6.. EMP-067 ๅฑฑ็ฐ ๆฌก้ ใคใใ ใธใญใฆ Engineering Junior Eng 2024-04-01
q7r8s9t0.. EMP-089 ้ดๆจ ไธ้ ในใบใญ ใคใใญใฆ Engineering Engineer 2023-04-01
Showing 5 of 5 active employees in Engineering
hr onboard
Execute the full onboarding workflow for a new employee.
$ hr onboard --file ./new_hire_tanaka.json
Onboarding: ้ซๆฉ ็พๅฒ (ใฟใซใใท ใใตใญ)
Step 1/5: Create employee record ............. DONE
Employee ID: u1v2w3x4-y5z6-...
Employee No: EMP-103
Step 2/5: Assign department & position ....... DONE
Department: Marketing
Position: Associate
Step 3/5: Generate employment contract ....... DONE
Document ID: doc-789abc
Template: Standard Employment Contract (ๆญฃ็คพๅก้็จๅฅ็ดๆธ)
Step 4/5: Send for electronic signature ...... DONE
Signers: ้ซๆฉ ็พๅฒ, ็ณๅ ้ไน (HR Manager)
Status: Awaiting signatures
Step 5/5: Register social insurance .......... DONE
Health Insurance: Application prepared (่ณๆ ผๅๅพๅฑ)
Pension: Application prepared (ๅ็ๅนด้่ณๆ ผๅๅพๅฑ)
Employment Ins: Application prepared (้็จไฟ้บ่ณๆ ผๅๅพๅฑ)
Onboarding complete for ้ซๆฉ ็พๅฒ
Start date: 2026-04-01
Next steps: Awaiting e-signatures, submit insurance forms to Pension Office
hr documents
Generate and manage HR documents.
$ hr documents --generate --type "zaiseki-shomeisho" --employee EMP-001
Document generated successfully
Type: ๅจ็ฑ่จผๆๆธ (Certificate of Employment)
Employee: ็ณๅ ้ไน (EMP-001)
Document ID: doc-456def
Generated: 2026-03-01 10:15:22 JST
Format: PDF (A4)
Status: Ready for download
Download: hr documents --download doc-456def --output ./certificates/
hr departments
Manage department hierarchy.
$ hr departments --tree
Organization Structure:
ClawHub Inc. (ๆฌ็คพ)
โโโ Engineering (ๆ่ก้จ)
โ โโโ Backend Team (ใใใฏใจใณใใใผใ ) [5 members]
โ โโโ Frontend Team (ใใญใณใใจใณใใใผใ ) [4 members]
โ โโโ Infrastructure (ใคใณใใฉใใผใ ) [3 members]
โโโ Marketing (ใใผใฑใใฃใณใฐ้จ) [6 members]
โโโ Sales (ๅถๆฅญ้จ) [8 members]
โ โโโ Domestic (ๅฝๅ
ๅถๆฅญ) [5 members]
โ โโโ International (ๆตทๅคๅถๆฅญ) [3 members]
โโโ HR & Admin (ไบบไบ็ทๅ้จ) [4 members]
โโโ Finance (็ต็้จ) [3 members]
Departments: 10 | Total employees: 33
hr payroll
Extract and synchronize payroll data.
$ hr payroll --period 2026-02 --export
Payroll Data Export: February 2026
Period: 2026-02-01 to 2026-02-28
Emp No. Name Base Salary Overtime Transport Deductions Net Pay
โโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโ
EMP-001 ็ณๅ ้ไน ยฅ450,000 ยฅ45,000 ยฅ15,000 ยฅ128,500 ยฅ381,500
EMP-015 ไฝ่ค ่ฑๅญ ยฅ380,000 ยฅ22,800 ยฅ12,000 ยฅ104,700 ยฅ310,100
EMP-042 ็ฐไธญ ๅคช้ ยฅ320,000 ยฅ38,400 ยฅ15,000 ยฅ93,200 ยฅ280,200
... (30 more) ... ... ... ... ...
Total Gross: ยฅ14,850,000
Total Net: ยฅ11,284,500
Exported to: ./payroll_202602.csv
hr custom-fields
Manage custom field templates.
$ hr custom-fields --list
Field ID Label Type Group Required
โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโ
cf-001 ่กๆถฒๅ DROPDOWN Health Info No
cf-002 ็ทๆฅ้ฃ็ตกๅ
TEXT Emergency Yes
cf-003 ่ณๆ ผใปๅ
่จฑ MULTI_SELECT Qualifications No
cf-004 ๅ่ท็ต้จๅนดๆฐ NUMBER Career No
cf-005 ใชใขใผใใฏใผใฏๅฏๅฆ BOOLEAN Work Style No
Total: 5 custom field templates
hr export
Bulk export employee data.
$ hr export --scope active --format csv --fields "emp_no,name,department,position,hire_date" \
--output ./employees_active.csv
Export: Active employees
Fields: Employee No, Name, Department, Position, Hire Date
Format: CSV (UTF-8 with BOM)
Exporting: [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 33/33
Export complete
File: ./employees_active.csv
Records: 33
Size: 8.4 KB
hr search
Search employees by various criteria.
$ hr search "joined after 2025-04-01 in Engineering"
Search results: 2 employees
Emp No. Name Department Position Hire Date Status
โโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโ
EMP-067 ๅฑฑ็ฐ ๆฌก้ Engineering Junior Eng 2025-04-01 Active
EMP-089 ้ดๆจ ไธ้ Engineering Engineer 2025-10-01 Active
Matched: 2 of 33 total employees
hr report
Generate compliance and analytics reports.
$ hr report --type headcount --period 2026-Q4
Headcount Report: Q4 FY2025 (January - March 2026)
Department Jan Feb Mar Change
โโโโโโโโโโโโโโโโโโ โโโโโ โโโโโ โโโโโ โโโโโโ
Engineering 11 12 12 +1
Marketing 6 6 6 0
Sales 8 8 8 0
HR & Admin 4 4 4 0
Finance 3 3 3 0
โโโโโโโโโโโโโโโโโโ โโโโโ โโโโโ โโโโโ โโโโโโ
Total 32 33 33 +1
New hires: 1 | Departures: 0 | Turnover rate: 0.0%
hr compliance
Check compliance status for government filings.
$ hr compliance --check
Compliance Status Check: March 2026
Check Status Due Date Action
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโโ
36ๅๅฎ (Overtime agreement) renewal OK 2026-03-31 Filed
็คพไผไฟ้บ ็ฎๅฎๅบ็คๅฑ (Standard monthly) PENDING 2026-07-10 4 months ahead
ๅดๅไฟ้บ ๅนดๅบฆๆดๆฐ (Labor insurance renewal) PENDING 2026-07-10 4 months ahead
ไฝๆฐ็จ ็นๅฅๅพดๅ (Resident tax withholding) OK Monthly Current
ๆบๆณๅพดๅ (Income tax withholding) OK Monthly Current
ใใคใใณใใผๅ้ (My Number collection) WARNING - 2 employees missing
Status: 4 OK | 2 PENDING | 1 WARNING
Action required: Collect My Number from EMP-067, EMP-089
Workflow
HR Admin SmartHR Agent SmartHR API
โโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโ
โ โ โ
โ hr onboard โ โ
โ --file new_hire.json โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ โ
โ โ Validate JSON payload โ
โ โ Check required fields โ
โ โ โ
โ โ POST /api/v1/crews โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ
โ โ 201 {id: "uuid..."} โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 1: Record created โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ PUT /api/v1/crews/{id} โ
โ โ (department, position) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 2: Dept assigned โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ POST /api/v1/documents โ
โ โ (contract template) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 3-5: Contract, โ Generate, sign, insure โ
โ signature, insurance โโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ โ
โ Onboarding complete โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
Error Handling
| Error | Cause | Solution |
|---|
401 Unauthorized: Invalid access token | Token expired or revoked | Regenerate the access token in SmartHR developer console. Tokens expire after 2 hours; use refresh tokens for long-running scripts. |
403 Forbidden: Insufficient scope | Token does not have required permission scope | Request additional scopes when creating the OAuth application (e.g., employees:read, documents:write). |
404 Not Found: Employee does not exist | Employee UUID is invalid or employee has been permanently deleted | Verify the employee ID. Retired employees remain accessible; only purged records return 404. Use hr search to find the correct ID. |
422 Unprocessable Entity: Missing furigana | Katakana reading (yomi) fields are required but empty | Provide last_name_yomi and first_name_yomi in katakana. SmartHR requires these for all employee records. |
422 My Number format invalid | My Number must be exactly 12 digits with valid check digit | Verify the My Number with the employee. The agent validates the check digit algorithm locally before submission. |
429 Rate Limit Exceeded | More than 60 requests per minute | Agent automatically queues and retries. For bulk imports, use the dedicated bulk endpoint which has separate limits. |
409 Conflict: Concurrent modification | Another user modified the same record simultaneously | Refresh the record with hr employees --id UUID, review changes, and retry the operation. |
FAQ
1. What SmartHR plans support API access?
API access is available on SmartHR Standard and Professional plans. The free plan (SmartHR Free) does not include API access.
2. How do I handle the April mass hiring (ไธๆฌๆก็จ)?
Use hr onboard --bulk --file ./april_hires.csv to process multiple new hires. The agent executes onboarding workflows in parallel (up to 5 concurrent) with proper rate limiting.
3. Can I generate year-end adjustment (ๅนดๆซ่ชฟๆด) forms?
Yes. Use hr documents --generate --type "nenmatsu-chosei" --year 2025 --scope all-active. This generates the withholding tax slip and deduction summaries for each employee.
4. How is My Number (ใใคใใณใใผ) handled securely?
My Number values are never logged, cached, or displayed in plaintext. The agent masks them as ****-****-**** in all output. Transmission occurs only over TLS. Set SMARTHR_MASK_PII=true (default) for additional protection.
5. Can I sync payroll data with external payroll providers?
Yes. hr payroll --export --format freee exports in freee-compatible CSV format. Also supports Money Forward, Yayoi, and generic CSV formats.
6. How do I manage employee status transitions?
Use hr employees --id UUID --status on_leave --reason "maternity" for leave, or --status retired --last-day 2026-03-31 for departures. Each transition triggers appropriate document generation.
7. What document types can be generated?
Employment certificates (ๅจ็ฑ่จผๆๆธ), income certificates (ๆๅพ่จผๆๆธ), withholding tax slips (ๆบๆณๅพดๅ็ฅจ), social insurance forms (็คพไผไฟ้บๅฑๅบๆธ), employment contracts, and custom templates.
8. How do I handle dependent (ๆถ้คๅฎถๆ) management?
Use hr employees --id UUID --dependents to view/manage dependents. The agent validates income thresholds (1,030,000 yen for tax, 1,300,000 yen for insurance) automatically.
9. Can I create custom document templates?
Yes. Upload custom templates via hr documents --upload-template ./template.docx --name "Custom NDA". SmartHR supports variable substitution using {{employee.name}} syntax.
10. How does the electronic signature workflow work?
Create the document, assign signers in order, and send. hr documents --sign --doc doc-123 --signers EMP-001,EMP-015. Track status with hr documents --status doc-123.
11. What is the data retention policy?
SmartHR retains data per your plan. The agent's local cache is cleared on TTL expiration. Audit logs are retained for 90 days locally. Configure SMARTHR_LOG_DIR for custom retention paths.
12. Can I integrate with Slack or ChatWork for HR notifications?
Yes. Use hr report --notify slack or --notify chatwork to send compliance alerts and onboarding status updates to your messaging platform via webhook.
Data Storage
The SmartHR Agent stores operational data securely:
~/.smarthr-agent/
โโโ config.yaml # Tenant, subdomain, auth settings
โโโ cache/
โ โโโ departments.json # Department tree cache (TTL: 30 minutes)
โ โโโ positions.json # Position list cache (TTL: 1 hour)
โ โโโ custom_fields.json # Custom field schema cache (TTL: 1 hour)
โ โโโ employees/ # Employee list cache (TTL: 10 minutes)
โโโ templates/
โ โโโ onboard_default.json # Default onboarding workflow template
โ โโโ custom/ # User-defined workflow templates
โโโ exports/
โ โโโ payroll_202602.csv # Recent export files (auto-cleanup: 30 days)
โโโ logs/
โ โโโ api-2026-03.log # Monthly API log (PII masked)
โ โโโ audit.log # Compliance-relevant action log
โ โโโ errors.log # Error details with remediation hints
โโโ secrets/
โโโ .token # Encrypted access token (keychain-backed)
All PII is masked in logs by default. The secrets directory uses OS-level keychain integration (macOS Keychain, Linux secret-tool) for token storage. Cache TTLs are tuned to balance performance with data freshness for HR-critical operations.
Comparison
| Feature | SmartHR Agent | BambooHR CLI | Workday CLI | freee HR CLI | KING OF TIME CLI |
|---|
| Japanese labor law compliance | Native (็คพไฟ/ๅดไฟ/ๅนด่ชฟ) | No | Partial | Partial | Attendance only |
| My Number handling | Secure (masked/encrypted) | N/A | N/A | Yes | N/A |
| Document generation | 10+ templates native | Limited | Complex | Limited | No |
| Electronic signatures | Built-in workflow | Third-party | DocuSign | Third-party | No |
| Furigana support | Native (katakana yomi) | No | No | Yes | No |
| Year-end adjustment | Full workflow | N/A | N/A | Yes | N/A |
| Payroll export formats | freee, MF, Yayoi, CSV | CSV only | Proprietary | Native | N/A |
| Onboarding automation | 5-step workflow | Basic | Complex | Basic | No |
| Department tree | Full hierarchy CRUD | Flat list | Hierarchy | Flat list | N/A |
| Companies served | 70,000+ (Japan) | 33,000+ (Global) | Enterprise | 400,000+ (Japan) | 56,000+ (Japan) |